C++ Programming - Objects and Classes

Exercise :: Objects and Classes - General Questions

11. 

Which of the following can access private data members or member functions of a class?

A. Any function in the program.
B. All global functions in the program.
C. Any member function of that class.
D. Only public member functions of that class.

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.

12. 

Which of the following type of data member can be shared by all instances of its class?

A. Public
B. Inherited
C. Static
D. Friend

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.

13. 

Which of the following also known as an instance of a class?

A. Friend Functions
B. Object
C. Member Functions
D. Member Variables

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.

14. 

Constructor is executed when _____.

A. an object is created
B. an object is used
C. a class is declared
D. an object goes out of scope.

Answer: Option A

Explanation:

No answer description available for this question. Let us discuss.

15. 

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

Explanation:

No answer description available for this question. Let us discuss.