Multiple Choice 1. (TCO 2) A class object can be _____. That is, it is created e
ID: 440046 • Letter: M
Question
Multiple Choice
1. (TCO 2) A class object can be _____. That is, it is created each time control reaches its declaration, and destroyed when the control exits the surrounding block. (Points : 4) staticautomatic
local
public
2. (TCO 3) When composition is used: (Points : 4) the host object is constructed first and then the member objects are placed into it.
member objects are constructed first, in the order they appear in the host constructor's initializer list.
member objects are constructed first, in the order they are declared in their own class.
member objects are constructed last, in the order they are declared in the host's class.
3. (TCO 4) A derived class (Points : 4) can never access public members of a base class.
can directly access public members of a base class.
cannot change the value of public members of a base class.
can only directly access private members of the base class.
4. (TCO 4) If inheritance is private (Points : 4) public and protected members of the base class become private members of the derived class.
all private members of the base class become public members of the derived class.
protected members of the base class become public members of the derived class.
none of the members of the base class become members of the derived class.
5. (TCO 4) Suppose that bClass is a class. Which of the following statements correctly derives the class dClass from bClass? (Points : 4) class dClass:: public bClass{ //classMembersList};
class dClass: private bClass{ //classMembersList};
class dClass:: protected bClass{ //classMembersList};
class bClass: public dClass{ //classMembersList};
6. (TCO 4) OOP implements _____. (Points : 4) UML
IPE
EIP
OOD
7. (TCO 4) Consider the following class definitions:
class bClass
{
public:
void setX(int);
void print() const;
private:
int x;
};
class dClass: public bClass
{
public:
void setXY(int, int);
void print() const;
private:
int y;
};
Which of the following statements correctly redefines the member function print of bClass? (Points : 4) void dClass::print() const {dClass:print(); }
void dClass::print() const { cout << endl; }
void bClass::print() const { cout endl; }
void dClass::print() const { bClass::print(); cout }
8. (TCO 4) If class AClass is derived from class BClass, which one of the following statements correctly states the destructor call sequence when an object of AClass goes out of scope? (Points : 4) BClass destructor first, AClass destructor second
AClass destructor first, BClass destructor second
BClass destructor only; the AClass destructor is not called if AClass derived private from BClass
AClass destructor only; the BClass destructor is not called if BClass derived private from AClass
9. (TCO 4) Which of the following statements correctly describes an example of multiple inheritance? (Points : 4) Mother and Father to Children
Animal to Reptile to Snake
Parent to Child
Animal to Mammal and Bird
10. (TCO 8) Which is a C++ reserved word used in a statement related to overlapping global identifier names? (Points : 4) namespace
class
#define
extern
Explanation / Answer
b c d d b a c c d a
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.