Quiz: Inheritance

To View Tricks: Login Required

Number of Questions: 20

Question: 1 -

What will be the order of execution of base class constructors in the following method of inheritance.class a: public b, public c {...};

Options:
  1. b(); a(); c();

  2. c(); b(); a();

  3. a(); b(); c();

  4. b(); c(); a();

  5. Answer:

    b(); c(); a();

    Solution not available.

Question: 2 -

Inheritance allow in C++ Program?

Options:
  1. Extendibility

  2. All of the above

  3. Creating a hierarchy of classes

  4. Class Re-usability

  5. Answer:

    All of the above

    Solution not available.

Question: 3 -

What is meant by multiple inheritance?

Options:
  1. None of the mentioned

  2. Deriving a base class from derived class

  3. Deriving a derived class from base class

  4. Deriving a derived class from more than one base class

  5. Answer:

    Deriving a derived class from more than one base class

    Solution not available.

Question: 4 -

Which design patterns benefit from the multiple inheritances?

Options:
  1. Adapter and observer pattern

  2. Glue pattern

  3. Code pattern

  4. None of the mentioned

  5. Answer:

    Adapter and observer pattern

    Solution:

    A template is a formula for creating a generic class


Question: 5 -

When the inheritance is private, the private methods in base class are __________ in the derived class.

Options:
  1. Protected

  2. Accessible

  3. Inaccessible

  4. Public

  5. Answer:

    Inaccessible

    Solution:

     When the inheritance is private, the private methods in base class are inaccessible in the derived class