C++ Programming - Objects and Classes

Exercise :: Objects and Classes - General Questions

16. 

How many objects can be created from an abstract class?

A. Zero
B. One
C. Two
D. As many as we want

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.

17. 

What does the class definitions in following code represent?

class Bike
{
    Engine objEng;
};
class Engine
{
    float CC;
};

A. kind of relationship
B. has a relationship
C. Inheritance
D. Both A and B

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.

18. 

Which of the following statements is correct when a class is inherited privately?

A. Public members of the base class become protected members of derived class.
B. Public members of the base class become private members of derived class.
C. Private members of the base class become private members of derived class.
D. Public members of the base class become public members of derived class.

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.

19. 

Which of the following statements is correct?

A. Data items in a class must be private.
B. Both data and functions can be either private or public.
C. Member functions of a class must be private.
D. Constructor of a class cannot be private.

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.

20. 

What does a class hierarchy depict?

A. It shows the relationships between the classes in the form of an organization chart.
B. It describes "has a" relationships.
C. It describes "kind of" relationships.
D. It shows the same relationship as a family tree.

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.