Quiz: Inheritance

To View Tricks: Login Required

Number of Questions: 20

Question: 1 -

Inheritance allow in C++ Program?

Options:
  1. All of the above

  2. Class Re-usability

  3. Creating a hierarchy of classes

  4. Extendibility

  5. Answer:

    All of the above

    Solution not available.

Question: 2 -

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

Options:
  1. Protected

  2. Inaccessible

  3. Public

  4. Accessible

  5. Answer:

    Inaccessible

    Solution:

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


Question: 3 -

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. a(); b(); c();

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

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

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

  5. Answer:

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

    Solution not available.

Question: 4 -

Which design patterns benefit from the multiple inheritances?

Options:
  1. Glue pattern

  2. None of the mentioned

  3. Code pattern

  4. Adapter and observer pattern

  5. Answer:

    Adapter and observer pattern

    Solution:

    A template is a formula for creating a generic class


Question: 5 -

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 more than one base class

  4. Deriving a derived class from base class

  5. Answer:

    Deriving a derived class from more than one base class

    Solution not available.