C++ Constructors Question:
Download Questions PDF

Which of the following statement is correct?

A. A constructor has the same name as the class in which it is present.
B. A constructor has a different name than the class in which it is present.
C. A constructor always returns an integer.
D. A constructor cannot be overloaded.

Answer:

Option A
A constructor has the same name as the class in which it is present.

Download C++ Constructors Interview Questions And Answers PDF

Previous QuestionNext Question
Copy constructor must receive its arguments by __________ .

A. either pass-by-value or pass-by-reference
B. only pass-by-value
C. only pass-by-reference
D. only pass by address
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