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

Cpp Programming Quiz 130 – Which of the following is the only technical difference between structures and classes in C++?

Question: Which of the following is the only technical difference between structures and classes in C++?
[A]. Member function and data are by default protected in structures but private in classes.
[B]. Member function and data are by default private in structures but public in classes.[C]. Member function and data are by default public in structures but private in classes.
[D]. Member function and data are by default public in structures but protected in classes.

Answer: Option C

 

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

Question: Which of the following statements is correct when a class is inherited publicly?
[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 protected members of derived class.
[D]. Public members of the base class become public members of derived class.

Answer: Option D

Cpp Programming Quiz 133 – Which of the following statements is correct about the constructors and destructors?

Question: Which of the following statements is correct about the constructors and destructors?
[A]. Destructors can take arguments but constructors cannot.
[B]. Constructors can take arguments but destructors cannot.[C]. Destructors can be overloaded but constructors cannot be overloaded.
[D]. Constructors and destructors can both return a value.

Answer: Option B

Cpp Programming Quiz 136 – Which of the following statements is incorrect?

Question: Which of the following statements is incorrect?
[A]. Friend keyword can be used in the class to allow access to another class.
[B]. Friend keyword can be used for a function in the public section of a class.[C]. Friend keyword can be used for a function in the private section of a class.
[D]. Friend keyword can be used on main().

Answer: Option D

Cpp Programming Quiz 137 – Which of the following statements are correct for a static member function?

Question: Which of the following statements are correct for a static member function?
  1. It can access only other static members of its class.
  2. It can be called using the class name, instead of objects.

[A]. Only 1 is correct.
[B]. Only 2 is correct.[C]. Both 1 and 2 are correct.
[D]. Both 1 and 2 are incorrect.

Answer: Option C