Question 98Asked in BPSC TRE 2.0 (2023) Computer Class 9-10

What will happen if in a C++ program, a class has no name?

  1. AIt is not even allowed in C++
  2. BIt will not have the constructor
  3. CIt will not have the destructor
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (C) It will not have the destructor

Explanation

An unnamed class is allowed, but a destructor is declared with the class name, so such a class cannot declare a destructor; the official key is (C).

From BPSC TRE 2.0 (2023) Computer Class 9-10 — Previous Year Paper

This is question 98 of BPSC TRE 2.0 (2023) Computer Class 9-10 — Previous Year Paper. 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.