100+ MCQ on Constructor and Destructor in C++ - 1

Question: 1

Which of the following is not true?

(A) Copy constructor is invoked when an object is passed by reference to constructor

(B) Copy constructor is invoked when a member function returns an object

(C) Copy constructor is invoked whenever object is created

(D) Copy constructor is invoked when an object is passed as a parameter to a member function

Ans: C

Copy constructor is invoked whenever object is created

Question: 2

Which of the following is automatically executed when the control reaches the end of class scope?

(A) Inline function

(B) Member function

(C) Destructor

(D) Constructor

Ans: C

Destructor

Question: 3

Which of the following is a function that removes the allocated memory of an object?

(A) Copy constructor

(B) Member function

(C) Destructor

(D) Constructor

Ans: C

Destructor

Question: 4

Which of the following is true?

(A) The constructor function can be overloaded

(B) The constructor is executed automatically

(C) A constructor can have parameter list

(D) All the given are true

Ans: D

All the given are true

Question: 5

Which one of the following initializes a class object and allocates memory space?

(A) Member function

(B) Constructor

(C) Destructor

(D) None of the given

Ans: B

Constructor

Related Questions