Home - Cpp Programming - Constructors And Destructors

Constructors And Destructors Online Exam Quiz

Important questions about Constructors And Destructors. Constructors And Destructors MCQ questions with answers. Constructors And Destructors exam questions and answers for students and interviews.

1. Destructors __________ for automatic objects if the program terminates with a call to function exit or function abort.


A : are called

B : are inherited

C : are not called

D : are created

2. A class's __________ is called when an object is destroyed.


A : constructor

B : destructor

C : assignment function

D : copy constructor

3. Destructor calls are made in which order of the corresponding constructor calls?


A : Reverse order

B : Forward order

C : Depends on how the object is constructed

D : Depends on how many objects are constructed

4. A constructor that accepts __________ parameters is called the default constructor.


A : one

B : two

C : no

D : three

6. What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor?


A : Compile-time error.

B : Preprocessing error.

C : Runtime error.

D : Runtime exception.

7. A function with the same name as the class, but preceded with a tilde character (~) is called __________ of that class.


A : constructor

B : destructor

C : function

D : object

8. A union that has no constructor can be initialized with another union of __________ type.


A : different

B : same

C : virtual

D : class

9. If the copy constructor receives its arguments by value, the copy constructor would


A : call one-argument constructor of the class

B : work without any problem

C : call itself recursively

D : call zero-argument constructor

10. Copy constructor must receive its arguments by __________ .


A : either pass-by-value or pass-by-reference

B : only pass-by-value

C : only pass-by-reference

D : only pass by address

1. __________ used to make a copy of one class object from another class object of the same class type.


A : constructor

B : copy constructor

C : destructor

D : default constructor

2. A __________ is a constructor that either has no parameters, or if it has parameters, all the parameters have default values.


A : default constructor

B : copy constructor

C : Both A and B

D : None of these

3. Which of the following statement is correct about constructors?


A : A constructor has a return type.

B : A constructor cannot contain a function call.

C : A constructor has no return type.

D : A constructor has a void return type.

4. Constructors __________ to allow different approaches of object construction.


A : cannot overloaded

B : can be overloaded

C : can be called

D : can be nested

5. How many default constructors per class are possible?


A : Only one

B : Two

C : Three

D : Unlimited

6. To ensure that every object in the array receives a destructor call, always delete memory allocated as an array with operator __________ .


A : destructor

B : delete

C : delete[]

D : kill[]

7. Which of the following gets called when an object goes out of scope?


A : constructor

B : destructor

C : main

D : virtual function

8. Which of the following cannot be declared as virtual?


A : Constructor

B : Destructor

C : Data Members

D : Both A and C

9. Which of the following are NOT provided by the compiler by default?


A : Zero-argument Constructor

B : Destructor

C : Copy Constructor

D : Copy Destructor

1. If the programmer does not explicitly provide a destructor, then which of the following creates an empty destructor?


A : Preprocessor

B : Compiler

C : Linker

D : main() function

2. When are the Global objects destroyed?


A : When the control comes out of the block in which they are being used.

B : When the program terminates.

C : When the control comes out of the function in which they are being used.

D : As soon as local objects die.

Cpp Programming more Online Exam Quiz

Copyright © 2021
Exam-GK-MCQ-Questions.Com | Contact Us | Privacy Policy | Terms of Use | Sitemap | 0.021122932434082