Skip to content
Sharp

Object-oriented programming · interview question

Why are constructors important in beginner object modeling?

Multiple choiceMediumchapter-2-curatedpremiumoopconstructors
Choose one answer
Answer and explanation

Correct answer

D. They make required creation data visible and help objects start in a valid state

Why

Constructors are more than syntax. They make the required data obvious at the creation site and reduce the risk of half-initialized objects drifting through the program.

Test yourself on Object-oriented programming

A free test with instant, explained results. No account needed.

Start free test
All Object-oriented programming questions →