closepop
closepop

Would you like to submit the test?


C++ :

Constructors and Destructors




1.
A constructor that accepts __________ parameters is called the default constructor.

one
two
no
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?

Compile-time error.
Preprocessing error.
Runtime error.
Runtime exception.




3.
Can a class have virtual destructor?

yes
no




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

!
?
~
$




5.
For automatic objects, constructors and destructors are called each time the objects

enter and leave scope
inherit parent class
are constructed
are destroyed




6.
Which constructor function is designed to copy objects of the same class type?

Create constructor
Object constructor
Dynamic constructor
Copy constructor




7.
Which of the following statement is correct?

Constructor has the same name as that of the class.
Destructor has the same name as that of the class with a tilde symbol at the beginning.
Both A and B.
Destructor has the same name as the first member function of the class.




8.
Which of the following statement is incorrect?

Constructor is a member function of the class.
The compiler always provides a zero argument constructor.
It is necessary that a constructor in a class should always be public.
Both B and C.




9.
When are the Global objects destroyed?

When the control comes out of the block in which they are being used.
When the program terminates.
When the control comes out of the function in which they are being used.
As soon as local objects die.




10.
A union that has no constructor can be initialized with another union of __________ type.

different
same
virtual
class




11.
Which of the following gets called when an object goes out of scope?

constructor
destructor
main
virtual function




12.
Constructors __________ to allow different approaches of object construction.

cannot overloaded
can be overloaded
can be called
can be nested




13.
Which of the following cannot be declared as virtual?

Constructor
Destructor
Data Members
Both A and C




14.
Which of the following are NOT provided by the compiler by default?

Zero-argument Constructor
Destructor
Copy Constructor
Copy Destructor




15.
 It is a __________ error to pass arguments to a destructor.

logical
virtual
syntax
linker










FreshersLive - No.1 Job site in India. Here you can find latest 2016 government as well as private job recruitment notifications for different posts vacancies in India. Get top company jobs for both fresher and experienced. Job Seekers can get useful interview tips, resume services & interview Question and answer. Practice online test free which is helpful for interview preparation. Register with us to get latest employment news/rojgar samachar notifications. Also get latest free govt and other sarkari naukri job alerts daily through E-mail.


FreshersLive - No.1 Job site in India. Here you can find latest 2016 government as well as private job recruitment notifications for different posts vacancies in India. Get top company jobs for both fresher and experienced. Job Seekers can get useful interview tips, resume services & interview Question and answer. Practice online test free which is helpful for interview preparation. Register with us to get latest employment news/rojgar samachar notifications. Also get latest free govt and other sarkari naukri job alerts daily through E-mail.