Classes & Objects MCQ Questions

21. Constructor is executed when _____.

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

View Answer

22. How many ways of reusing are there in class hierarchy?

A. 1
B. 3
C. 4
D. 2

View Answer

23. Where does the object is created?

A. Class
B. Constructor
C. Destructors
D. Attributes

View Answer

24. Which of the following is a valid class declaration?

A. Class A { int x; };
B. Class B { }
C. Public class A { }
D. Object A { int x; };

View Answer

25. Which of the following is not correct (in C++) ?i) Class templates and function templates are instantiated in the same way ii) Class templates differ from function templates in the way they are initiated iii) Class template is initiated by defining an object using the template argument iv) Class templates are generally used for storage classes.

A. i
B. i & ii
C. ii ,iii, iv
D. iv

View Answer

26. Which of the following keywords is used to control access to a class member?

A. Default
B. Break
C. Protected
D. Asm

View Answer

27. Which of the following statements is incorrect?

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.

View Answer

28. Which operator can not be overloaded?

A. +
B. ::
C. -
D. *

View Answer

29. When Virtual Table is created?

A. Every Class has VTable
B. Class inherited from other Class
C. Class has atleast one Virtual Function
D. When a Class Overrides the function of Base class

View Answer

30. What is the size of empty class?

A. 0
B. 2
C. 4
D. 1

View Answer

Also check :


* You must be logged in to add comment.