Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

MULTIPLE CHOICE QUESTIONS AND ANSWERS

1. True/False: A class can serve as base class for many derived classes.

Answer: True

2. When a class serves as base class for many derived classes, the situation is called:
1. polymorphism
2. hierarchical inheritance
3. hybrid inheritance
4. multipath inheritance
5. none of these

Answer: (b)

3. When two or more classes serve as base class for a derived class, the situation is known
as __________.
1. multiple inheritance
2. polymorphism
3. encapsulation
4. hierarchical inheritance
5. none of these

Answer: (a)

4. Multiple inheritance leaves room for a derived class to have _______ members.
1. dynamic
2. private
3. public
4. ambiguous
5. none of these

Answer: (d)

5. Hybrid inheritance is ___________.


1. multiple inheritance
2. multilevel inheritance
3. multipath inheritance
4. combination of a and b
5. combination of a and c

Answer: (d)

6. Problems in multipath inheritance are resolved using ___________ keyword.


1. protected
2. virtual
3. explicit
4. private
5. none of these

Answer: (b)

7. True/False: Relationship between class polygon and class point can be described as has–a
relationship.

Answer: True

8. True/False: Relationship between class Manager and class Employee can be described as
is–a relationship.

Answer: True

9. Which of the following would be an invalid class declaration?


1. Class d: public b2, public b1
2. Class d: class b2, class b1
3. Class d: public b2, b1
4. Class d: b2, b1
5. none of these

Answer: (b)

You might also like