Skip to content
Sharp

Object-oriented programming · interview question

How does encapsulation contribute to a class's responsibility?

Multiple choiceMediumchapter-3-curatedpremiumoopinvariants-and-validation
Choose one answer
Answer and explanation

Correct answer

A. It centralizes control of data handling within the class.

Why

Encapsulation centralizes data handling within the class, ensuring that the class itself is responsible for maintaining data integrity and behavior.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →