ProgrammingEasyTCS NQT · Infosys pattern

Which OOP principle bundles data with the methods that act on it and hides the internal state behind an interface?

  1. A. Encapsulation
  2. B. Polymorphism
  3. C. Inheritance
  4. D. Abstraction through interfaces only

Correct answer: A. Encapsulation

Encapsulation keeps fields private and exposes behaviour through methods, so the object controls how its state changes. Inheritance reuses code; polymorphism lets one call behave differently by type.

More OOP with C++ and Java questions

Exams that ask this topic