Cpp Programming Quiz 122 – Which of the following statements about virtual base classes is correct?

Question: Which of the following statements about virtual base classes is correct?
[A]. It is used to provide multiple inheritance.
[B]. It is used to avoid multiple copies of base class in derived class.[C]. It is used to allow multiple copies of base class in a derived class.
[D]. It allows private members of the base class to be inherited in the derived class.

Answer: Option B

Cpp Programming Quiz 124 – What happens when we try to compile the class definition in following code snippet?

Question: What happens when we try to compile the class definition in following code snippet?

class Birds {};
class Peacock : protected Birds {};

[A].[ez-toc] It will not compile because class body of Birds is not defined.
[B].It will not compile because class body of Peacock is not defined.
[C].It will not compile because a class cannot be protectedly inherited from other class.
[D].It will compile succesfully.

Answer: Option D

Cpp Programming Quiz 125 – Which of the following statement is correct regarding destructor of base class?

Question: Which of the following statement is correct regarding destructor of base class?
[A].Destructor of base class should always be static.
[B].Destructor of base class should always be virtual.[C].Destructor of base class should not be virtual.
[D].Destructor of base class should always be private.

Answer: Option B

Cpp Programming Quiz 129 – Which of the following statements is correct when a class is inherited privately?

Question: Which of the following statements is correct when a class is inherited privately?
[A]. Public members of the base class become protected members of derived class.
[B]. Public members of the base class become private members of derived class.[C]. Private members of the base class become private members of derived class.
[D]. Public members of the base class become public members of derived class.

Answer: Option B