Saturday, September 27, 2014

Constructors and Destructors - C++

1. 
A constructor that accepts __________ parameters is called the default constructor.
A.oneB.two
C.noD.three
2. 
What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor?
A.Compile-time error.
B.Preprocessing error.
C.Runtime error.
D.Runtime exception.
3. 
Can a class have virtual destructor?
A.YesB.No
4. 
Destructor has the same name as the constructor and it is preceded by ______ .
A.!B.?
C.~D.$
5. 
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

No comments: