Sunday, September 28, 2014

Constructors and Destructors - C++

1. 
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
2. 
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.
3. 
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.
4. 
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.
5. 
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

No comments: