Explore topic-wise MCQs in Object Oriented Programming.

This section includes 20 Mcqs, each offering curated multiple-choice questions to sharpen your Object Oriented Programming knowledge and support exam preparation. Choose a topic below to get started.

1.

What happens when an object is passed by reference?

A. Destructor is not called
B. Destructor is called at end of function
C. Destructor is called when function is out of scope
D. Destructor is called when called explicitly
Answer» B. Destructor is called at end of function
2.

When an object is passed to a function, its copy is made in the function and then ______________

A. The destructor of the copy is called when function is returned
B. The destructor is never called in this case
C. The destructor is called but it is always implicit
D. The destructor must be user defined
Answer» B. The destructor is never called in this case
3.

Which class destructor will be called first, when following code go out of scope?

A. ~A()
B. ~B()
C. ~C()
D. ~B() and ~C()View Answer
Answer» D. ~B() and ~C()View Answer
4.

Which among the following is correct for the destructors concept?

A. Destructors can be overloaded
B. Destructors can have only one parameter at maximum
C. Destructors are always called after object goes out of scope
D. There can be only one destructor in a class
Answer» E.
5.

When is it advised to have user defined destructor?

A. When class contains some pointer to memory allocated in class
B. When a class contains static variables
C. When a class contains static functions
D. When a class is inheriting another class only
Answer» B. When a class contains static variables
6.

Global destructors execute in ___________ order after main function is terminated.

A. Sequential
B. Random
C. Reverse
D. Depending on priority
Answer» D. Depending on priority
7.

Destructors can be ________

A. Abstract type
B. Virtual
C. Void
D. Any type depending on situation
Answer» C. Void
8.

Destructors doesn’t accept parameters.

A. True
B. False
Answer» B. False
9.

How the constructors and destructors can be differentiated?

A. Destructor have a return type but constructor doesn’t
B. Destructors can’t be defined by the programmer, but constructors can be defined
C. Destructors are preceded with a tilde (~) symbol, and constructor doesn’t
D. Destructors are same as constructors in syntax
Answer» D. Destructors are same as constructors in syntax
10.

When is the destructor of a global object called?

A. Just before end of program
B. Just after end of program
C. With the end of program
D. Anytime when object is not needed
Answer» B. Just after end of program
11.

Choose the correct sequence of destructors being called for the following code.

A. ~A(), ~B(), ~C()
B. ~B(), ~C(), ~A()
C. ~A(), ~C(), ~B()
D. ~C(), ~B(), ~A()View Answer
Answer» E.
12.

If in multiple inheritance, class C inherits class B, and Class B inherits class A. In which sequence are their destructors called if an object of class C was declared?

A. ~C() then ~B() then ~A()
B. ~B() then ~C() then ~A()
C. ~A() then ~B() then ~C()
D. ~C() then ~A() then ~B()
Answer» B. ~B() then ~C() then ~A()
13.

Which among the following is correct for abstract class destructors?

A. It doesn’t have destructors
B. It has destructors
C. It may or may not have destructors
D. It contains an implicit destructor
Answer» B. It has destructors
14.

When a destructor is called?

A. After the end of object life
B. Anytime in between object’s lifespan
C. At end of whole program
D. Just before the end of object life
Answer» E.
15.

Which among the following describes a destructor?

A. A special function that is called to free the resources, acquired by the object
B. A special function that is called to delete the class
C. A special function that is called anytime to delete an object
D. A special function that is called to delete all the objects of a class
Answer» B. A special function that is called to delete the class
16.

DESTRUCTORS_CAN_BE_________?$

A. Abstract type
B. Virtual
C. Void
D. Any type depending on situation
Answer» C. Void
17.

When is it advised to have user defined destructor?$

A. When class contains some pointer to memory allocated in class
B. When a class contains static variables
C. When a class contains static functions
D. When a class is inheriting another class only
Answer» B. When a class contains static variables
18.

Global_destructors_execute_in_____________order_after_main_function_is_terminated$

A. Sequential
B. Random
C. Reverse
D. Depending on priority
Answer» D. Depending on priority
19.

~A()

A. ~B()
B. ~C()
C. ~B() and ~C()
Answer» B. ~C()
20.

Destructors doesn’t accept parameters?#

A. True
B. False
Answer» B. False