Here, you can read Constructor and Destructor multiple choice questions and answers with explanation.
1) The explicit keyword is an optional decoration for the constructors that takes exactly_____argument. - Published on 19 Oct 15
a. No argument
b. Two
c. Three
d. One
Answer
Explanation
|
ANSWER: One
Explanation: No explanation is available for this question!
|
|
2) The purpose of explicit keyword is to tell the compiler that a certain constructor may not be used to implicitly cast an expression to its class type. - Published on 19 Jul 15
a. True
b. False
Answer
Explanation
|
ANSWER: True
Explanation: No explanation is available for this question!
|
|
3) Is it possible to define a constructor with default arguments? - Published on 19 Jul 15
a. Yes
b. No
Answer
Explanation
|
ANSWER: Yes
Explanation: No explanation is available for this question!
|
|
4) Which of the following statements are not true about destructor?
1. It is invoked when object goes out of the scope 2. Like constructor, it can also have parameters 3. It can be virtual 4. It can be declared in private section 5. It bears same name as that of the class and precedes Lambda sign. - Published on 17 Jul 15
a. Only 2, 3, 5
b. Only 2, 3, 4
c. Only 2, 4, 5
d. Only 3, 4, 5
Answer
Explanation
|
ANSWER: Only 2, 4, 5
Explanation: No explanation is available for this question!
|
|
5) Assume class TEST. Which of the following statements is/are responsible to invoke copy constructor? - Published on 17 Jul 15
a. TEST T2(T1)
b. TEST T4 = T1
c. T2 = T1
d. both a and b
e. All of these
Answer
Explanation
|
ANSWER: both a and b
Explanation: No explanation is available for this question!
|
|
6) Can constructors be overloaded? - Published on 17 Jul 15
a. Yes
b. No
Answer
Explanation
|
ANSWER: Yes
Explanation: No explanation is available for this question!
|
|
7) A Constructor that does not have any parameters is called____________ Constructor. - Published on 17 Jul 15
a. Custom
b. Dynamic
c. Static
d. Default
Answer
Explanation
|
ANSWER: Default
Explanation: No explanation is available for this question!
|
|
8) Which of the followings are true about constructors?
1. A class can have more than one constructor. 2. They can be inherited. 3. Their address can be referred. 4. Constructors cannot be declared in protected section of the class. 5. Constructors cannot return values. - Published on 17 Jul 15
a. Only 1,2,4
b. 1,2,4,5
c. 1,3,5
d. 1,4,5
Answer
Explanation
|
ANSWER: 1,4,5
Explanation: No explanation is available for this question!
|
|
9) Is it mandatory to invoke/call a constructor for creating an object? - Published on 17 Jul 15
a. Yes
b. No
Answer
Explanation
|
ANSWER: Yes
Explanation: No explanation is available for this question!
|
|
10) If default constructor is not defined, then how the objects of the class will be created? - Published on 17 Jul 15
a. The compiler will generate error
b. Error will occur at run-time.
c. Compiler provides its default constructor to build the object.
d. None of these
Answer
Explanation
|
ANSWER: Compiler provides its default constructor to build the object.
Explanation: No explanation is available for this question!
|
|