250+ TOP MCQs on Derived Class and Answers

Object Oriented Programming (OOPs) Multiple Choice Questions & Answers (MCQs) on “Derived Class”.

1. Which among the following is best definition of a derived class?
a) A child class
b) A class which inherits one or more classes
c) A class with keyword derived
d) A class with more than one constructor
Answer: b
Clarification: Any class which inherits one or more classes is a derived class. The only condition is it must inherit at least one class in order to be called as a derived class.

2. Which among the following is inherited by a derived class from base class?
a) Data members only
b) Member functions only
c) All the members except private members
d) All the members of base class
Answer: c
Clarification: The class inheriting another class, inherits all the data members and member functions that are not private. This is done to ensure the security features with maximum flexibility.

3. If there is a derived class in a program, how many classes must be in that program?
a) 1
b) 2
c) 3
d) 4
Answer: b
Clarification: If there is a derived class in a program, there must be at least 2 classes in that program. One is a base class and another derived class. Hence at least 2 classes must be there.

4. Which members can never be accessed in derived class from the base class?
a) Private
b) Protected
c) Public
d) All except private
Answer: d
Clarification: There is no restriction for a derived class to access the members of the base class until and unless the members are private. Private member are declared so that those members are not accessible outside the class.

5. How many types of inheritance are supported in C++ for deriving a class?
a) 1
b) 2
c) 3
d) 4
Answer: c
Clarification: There are three types of inheritance possible. Private inheritance, protected inheritance, and public inheritance. The inheritance defines the access specifier to be used with the inherited members in the derived class.

6. How many derived class can a single base class have?
a) 1
b) 2
c) 3
d) As many are required
Answer: d
Clarification: There is no restriction on how many classes can inherit a single base class. Hence there can be as many derived classes as required in a program from a single base class.

7. Which among the following is correct?
a) Friend function of derived class can access non-private members of base class
b) Friend function of base class can access derived class members
c) Friend function of derived class can access members of only derived class
d) Friend function can access private members of base class of a derived class
Answer: a
Clarification: The friend function of a class can access the non-private members of base class. The reason behind is that the members of base class gets derived into the derived class and hence become members of derived class too. Hence a friend function can access all of those.

8. If a class is being derived using more than two base classes, which inheritance will be used?
a) Single
b) Multi-level
c) Hierarchical
d) Multiple
Answer: d
Clarification: The statement given is the definition of multiple inheritance with respect to the derived class. The concept can be illustrated with many other samples but the main aspects are base class and derived class only.

9. Derived class is also known as ______________ class.
a) Subclass
b) Small class
c) Big class
d) Noticeable class
Answer: a
Clarification: It is just another name given to the derived classes. This is used while denoting all the derived classes subsequent to a superclass.

10. If class A is derived from another derived class B which is derived from class C, which class will have maximum level of abstraction?
a) Class A
b) Class B
c) Class C
d) All have the same level of abstraction
Answer: c
Clarification: The abstraction level of class C will be maximum. This is because the parent class have higher level of abstraction. Hence the parent of all other class will have maximum level of abstraction.

11. If base class is an abstract class then derived class ______________ the undefined functions.
a) Must define
b) Must become another abstract class or define
c) Must become parent class for
d) Must implement 2 definitions of
Answer: b
Clarification: The function must be defined in the program which are not defined in the base class. Hence the class must be defined as abstract of implement the function definition in it.

12. How many classes can be derived from a derived class?
a) Only 1
b) At most 1
c) At least 1
d) As many as required
Answer: d
Clarification: When a class is to be derived from another derived class, the derived class behaves as a normal base class hence there are no restriction on how many class can be derived from a derived class. The derived class again behaves as a normal superclass.

13. The members of a derived class can never be derived.
a) True
b) False
Answer: b
Clarification: This is not true that the members of a derived class can’t be derived. All the classes are considered to be a normal class when used for derivation. The members can be derived with respect to their access specifiers.

14. Which feature is not related to the derived classes among the following?
a) Inheritance
b) Encapsulation
c) Run time memory management
d) Compile time function references
Answer: c
Clarification: The memory management is the feature that is not necessary for derived classes that will be a part of whole program. The functions references must be resolved for their proper use if inheritance is used.

15. Deriving a class in such a way that that the base class members are not available for further inheritance is known as ___________________
a) Public inheritance
b) Protected inheritance
c) Protected or private inheritance
d) Private inheritance
Answer: d
Clarification: The private members of a class can never be derived to another class. When a class derives another class using private inheritance, all the members become private members of the derived class. Hence these member won’t be available for further inheritance.

Leave a Reply

Your email address will not be published. Required fields are marked *