Exercise: Constructors And Destructors

Questions for: Constructors And Destructors

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: B
No answer description is available. Let's discuss.
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: D
No answer description is available. Let's discuss.
For automatic objects, constructors and destructors are called each time the objects
A:
enter and leave scope
B:
inherit parent class
C:
are constructed
D:
are destroyed
Answer: A
No answer description is available. Let's discuss.
Destructor has the same name as the constructor and it is preceded by ______ .
A:
!
B:
?
C:
~
D:
$
Answer: C
No answer description is available. Let's discuss.
Can a class have virtual destructor?
A:
Yes
B:
No
C:
D:
Answer: A
No answer description is available. Let's discuss.
Ad Slot (Above Pagination)
Quiz