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

Question: 6

A destructor name must be

(A) same as class name prefixed by tilde (~) character

(B) same as class name

(C) same as any other member function name

(D) none of the given

Ans: A

same as class name prefixed by tilde (~) character

Question: 7

Which of the following prototype can be a copy constructor of class myclass?

(A) myclass (myclass & ×)

(B) myclass copy (myclass a)

(C) int copy (myclass mc)

(D) myclass (int myclass)

Ans: A

myclass (myclass & ×)

Question: 8

A copy constructor is invoked when

(A) an object is passed by reference to constructor

(B) a member function returns an object

(C) an object is passed as a parameter to any of the member function

(D) all of the above

Ans: D

all of the above

Related Questions