Question 139

Which statement about constructors in C++ is TRUE?

  1. AThey must return an int
  2. BThey can be declared virtual
  3. CThey are called only explicitly
  4. DThey have the same name as the class and no return type
Show answerHide answer

Correct answer: (D) They have the same name as the class and no return type

Explanation

Constructors share the class name, have no return type and run automatically.

From DSSSB TGT Computer Science Full Mock Test 1

This is question 139 of DSSSB TGT Computer Science Full Mock Test 1. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.