Question 96Asked in BPSC TRE 2.0 (2023) Computer Science Class 11-12

A constructor is called whenever

  1. Aan object is created
  2. Ba class is created
  3. Ca class is declared
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (A) an object is created

Explanation

A constructor runs automatically each time an object of the class is created, and it initialises that object. Declaring a class does not call it.

From BPSC TRE 2.0 (2023) Computer Science Class 11-12 — Previous Year Paper

This is question 96 of BPSC TRE 2.0 (2023) Computer Science Class 11-12 — 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.