Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. (TCO 2) A class object can be _____. That is, it can be created once, when th

ID: 3657446 • Letter: 1

Question

1.(TCO 2) A class object can be _____. That is, it can be created once, when the control reaches its declaration, and destroyed when the program terminates.(Points : 4) static
automatic
local
public

2.(TCO 3) If an object of a ClassA is declared as a data member of ClassB, how may an objects of ClassB access the private data members of ClassA?(Points : 4) ClassA must have accessor functions that are declared public.
ClassA must not have private data members.
The ClassB object may access them just like its own private data members.
ClassA must be declared as a base class of ClassB.

3.(TCO 4) The private members of a base class can(Points : 4) never be accessed by a derived class.
be directly and indirectly accessed by a derived class.
be indirectly accessed by a derived class.
be directly accessed by a derived class.

4.(TCO 4) The constructors of a derived class(Points : 4) cannot directly initialize private members inherited from the base class.
can directly initialize any members inherited from the base class.
cannot directly initialize public members inherited from the base class.
can directly initialize private member functions inherited from the base 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) Which of the following statements about inheritance is true if the memberAccessSpecifier is protected?(Points : 4) The private members of the base class become protected members of the derived class.
The derived class can directly access any member of the base class.
The public members of the base class become protected members of the derived class.
The protected members of the base class become private members of the derived class.

7.(TCO 4) C++ supports(Points : 4) both single and multiple inheritance.
only single inheritance.
only multiple inheritance.
neither single nor multiple inheritance.

8.(TCO 4) Which one of the following statements is a correct example of inheritance?(Points : 4) An automobile has an engine.
An automobile is a Mustang.
A Mustang is an automobile.
An engine is part of an automobile.

9.(TCO 4) Which of the following statements does not correctly describe inheritance?(Points : 4) Going from a general description to a more specific description
Describes an "is a" relationship
Describes a "has a" relationship
Allows for reusable code

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 1.(TCO 2) A class object can be _____. That is, it can be created once, when the control reaches its declaration, and destroyed when the program terminates.(Points : 4) static
automatic
local
public

Explanation / Answer

automatic ClassA must not have private data members. be directly and indirectly accessed by a derived class. can directly initialize any members inherited from the base class. class dClass: private bClass{ //classMembersList}; class dClass: private bClass{ //classMembersList}; Going from a general description to a more specific description namespace