Skip to content
Sharp

Object-oriented programming · interview question

Which of the following is NOT an advantage of encapsulation?

Multiple choiceEasychapter-3-curatedpremiumoopcontrolled-mutation
Choose one answer
Answer and explanation

Correct answer

A. Allowing unrestricted access to class fields.

Why

Encapsulation restricts access to class fields, which helps in protecting object state, promoting modularity, and enhancing maintainability. Unrestricted access is contrary to the goals of encapsulation.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →