C++ Programming - Constructors and Destructors

Exercise :: Constructors and Destructors - General Questions

6. 

Which constructor function is designed to copy objects of the same class type?

A. Create constructor
B. Object constructor
C. Dynamic constructor
D. Copy constructor

Answer: Option D

Explanation:

No answer description available for this question. Let us discuss.

7. 

Which of the following statement is correct?

A. Constructor has the same name as that of the class.
B. Destructor has the same name as that of the class with a tilde symbol at the beginning.
C. Both A and B.
D. Destructor has the same name as the first member function of the class.

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.

8. 

Which of the following statement is incorrect?

A. Constructor is a member function of the class.
B. The compiler always provides a zero argument constructor.
C. It is necessary that a constructor in a class should always be public.
D. Both B and C.

Answer: Option D

Explanation:

No answer description available for this question. Let us discuss.

9. 

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.

Answer: Option B

Explanation:

No answer description available for this question. Let us discuss.

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

Answer: Option C

Explanation:

No answer description available for this question. Let us discuss.