Programming - C++ Language
You Are Here :: Home > C++ Language > constructor - General Questions
49. |
Which of the following statement is correct?
|
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.
|
|
Answer: Option C
Explanation:
|
50. |
Which of the following statement is incorrect?
|
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 publi
|
D.
|
Both B and C.
|
|
Answer: Option D
Explanation:
|
51. |
Which of the following statement is correct about constructors?
|
A. |
A constructor has a return type. |
B.
|
A constructor cannot contain a function call. |
C.
|
A constructor has no return type.
|
D.
|
A constructor has a void return type.
|
|
Answer: Option C
Explanation:
|
52. |
Which of the following statement is correct whenever an object goes out of scope?
|
A. |
The default constructor of the object is called. |
B.
|
The parameterized destructor is called. |
C.
|
The default destructor of the object is called.
|
D.
|
None of the above.
|
|
Answer: Option C
Explanation:
|
53. |
To ensure that every object in the array receives a destructor call, always delete memory allocated as an array with operator __________ .
|
A. |
destructor |
B.
|
delete |
C.
|
delete[]
|
D.
|
kill[]
|
|
Answer: Option C
Explanation:
|
54. |
Given a class named Book, which of the following is not a valid constructor?
|
A. |
Book ( ) { } |
B.
|
Book ( Book b) { } |
C.
|
Book ( Book &b) { }
|
D.
|
Book (char* author, char* title) { }
|
|
Answer: Option B
Explanation:
|
« prev
next »