Exercise: Constructors And Destructors

Questions for: Constructors And Destructors

Which of the following implicitly creates a default constructor when the programmer does not explicitly define at least one constructor for a class?
A:
Preprocessor
B:
Linker
C:
Loader
D:
Compiler
Answer: D
No answer description is available. Let's discuss.
Which of the following statement is correct about destructors?
A:
A destructor has void return type.
B:
A destructor has integer return type.
C:
A destructor has no return type.
D:
A destructors return type is always same as that of main().
Answer: C
No answer description is available. Let's discuss.
How many default constructors per class are possible?
A:
Only one
B:
Two
C:
Three
D:
Unlimited
Answer: A
No answer description is available. Let's discuss.
A __________ is a constructor that either has no parameters, or if it has parameters, all the parameters have default values.
A:
default constructor
B:
copy constructor
C:
Both A and B
D:
None of these
Answer: A
No answer description is available. Let's discuss.
If the programmer does not explicitly provide a destructor, then which of the following creates an empty destructor?
A:
Preprocessor
B:
Compiler
C:
Linker
D:
main() function
Answer: B
No answer description is available. Let's discuss.
Ad Slot (Above Pagination)
Quiz