1. Home
  2. Computer Science MCQs
  3. C++ and Object-Oriented Programming
  4. When does a constructor run for an automatic object?

Added 30 Nov -0001

When does a constructor run for an automatic object?

  1. When the object is first read from
  2. When the enclosing scope ends
  3. Only when new is used to create it
  4. When the object comes into existence Correct answer

Correct answer

D. When the object comes into existence

17 views

MCQSEXAM

Explanation

A constructor initialises the object automatically at the point where its definition is reached.

Reference

Asked in: NTS, PPSC IT, Campus Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More C++ and Object-Oriented Programming MCQs

Practise all C++ and Object-Oriented Programming MCQs

Similar MCQs