Constructors and Destructors Questions and Answers updated daily – C++



15 Constructors and Destructors Questions and answers section with explanation for various online exam preparation, various interviews, C++ Constructors and Destructors online test. Constructors and Destructors Questions with detailed description, explanation will help you to master the topic.

Constructors and Destructors Questions

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



SHOW ANSWER
Correct Ans:syntax
Explanation:


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



SHOW ANSWER
Correct Ans:Copy Destructor
Explanation:


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



SHOW ANSWER
Correct Ans:Both A and C
Explanation:


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



SHOW ANSWER
Correct Ans:can be overloaded
Explanation:


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



SHOW ANSWER
Correct Ans:destructor
Explanation:


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



SHOW ANSWER
Correct Ans:same
Explanation:


7. When are the Global objects destroyed?



SHOW ANSWER
Correct Ans:When the program terminates.
Explanation:


8. Which of the following statement is incorrect?



SHOW ANSWER
Correct Ans:Both B and C.
Explanation:


9. Which of the following statement is correct?



SHOW ANSWER
Correct Ans:Both A and B.
Explanation:


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



SHOW ANSWER
Correct Ans:Copy constructor
Explanation:


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



SHOW ANSWER
Correct Ans:enter and leave scope
Explanation:


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



SHOW ANSWER
Correct Ans:~
Explanation:


13. Can a class have virtual destructor?



SHOW ANSWER
Correct Ans:yes
Explanation:


14. 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?



SHOW ANSWER
Correct Ans:Compile-time error.
Explanation:


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



SHOW ANSWER
Correct Ans:no
Explanation:



FreshersLive - No.1 Job site in India. Here you can find latest 2017 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.