Constructors and Destructors - General Questions Online Exam Quiz
Constructors and Destructors - General Questions GK Quiz. Question and Answers related to Constructors and Destructors - General Questions. MCQ (Multiple Choice Questions with answers about Constructors and Destructors - General Questions
A constructor that accepts __________ parameters is called the default constructor.
Options
A : one
B : two
C : no
D : three
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?
Options
A : Compile-time error.
B : Preprocessing error.
C : Runtime error.
D : Runtime exception.
Can a class have virtual destructor?
Options
A : Yes
B : No
C : -
D : -
Destructor has the same name as the constructor and it is preceded by ______ .
Options
A : !
B : ?
C : ~
D : $
For automatic objects, constructors and destructors are called each time the objects
Options
A : enter and leave scope
B : inherit parent class
C : are constructed
D : are destroyed
Which constructor function is designed to copy objects of the same class type?
Options
A : Create constructor
B : Object constructor
C : Dynamic constructor
D : Copy constructor
Which of the following statement is correct?
Options
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.
Which of the following statement is incorrect?
Options
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.
When are the Global objects destroyed?
Options
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.
Copy constructor must receive its arguments by __________ .
Options
A : either pass-by-value or pass-by-reference
B : only pass-by-value
C : only pass-by-reference
D : only pass by address
Constructors and Destructors - General Questions more Online Exam Quiz
Operating Systems Concepts - Part 1
System Analysis and Design - Part 1
Objects and Classes - General Questions
OOPS Concepts - General Questions