MCQs – C++ Inheritance

Q)____________ members of base class are inaccessible to derived class

  1. Private
  2. Protected
  3. Public
  4. None

Answer: 1

Q) Accessing functions from multiple classes to a derived class is known as

  1. multiple inheritance
  2. single inheritance
  3. Hybrid inheritance
  4. multilevel inheritance

Answer: 1


Q) In inheritance, order of execution of base class and derived class destructors are

  1. Base to derived
  2. Derived to base
  3. Random order
  4. none

Answer: 2

In inheritance, execution order of constructors are always from base to derived and destructors call order is in reverse i.e. from derived to base. In polymorphic classes, means the class that contain virtual functions, we need to make destructor virtual in base class. Other wise the derived class destructor will not be called. Read detail about C++ virtual destructor with example.

MCQs – C++ Inheritance
Scroll to top