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

View Answer

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.

View Answer

Can a class have virtual destructor?

Options

A : Yes

B : No

C : -

D : -

View Answer

Destructor has the same name as the constructor and it is preceded by ______ .

Options

A : !

B : ?

C : ~

D : $

View Answer

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

View Answer

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

View Answer

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.

View Answer

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.

View Answer

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.

View Answer

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

View Answer

Constructors and Destructors - General Questions more Online Exam Quiz

Operating Systems Concepts - Part 1

System Analysis and Design - Part 1

Unix - Part 1

Windows 2000 Server - Part 1

Windows NT - Part 1

Functions - General Questions

Objects and Classes - General Questions

OOPS Concepts - General Questions

References - General Questions

Arrays - General Questions