Question
Which of the following best illustrates Encapsulation
in Object-Oriented Programming?Solution
Encapsulation is a key OOP principle that involves combining data (fields) and methods (functions) into a single unit (class) and controlling access to them using access modifiers like private, protected, and public. For instance, a BankAccount class might hide its balance field (using private access) and expose methods like deposit() and withdraw() to manipulate it. Encapsulation ensures data integrity and security , preventing unauthorized access or modifications. Why Other Options Are Incorrect : 2. Allowing multiple objects to interact through message passing : This describes Message Passing , which focuses on communication between objects. 3. Hiding complex implementation details from the user : This is Abstraction , not Encapsulation. 4. Enabling a class to inherit properties and methods from another class : This refers to Inheritance , unrelated to Encapsulation. 5. Defining a one-to-many relationship between objects : This aligns with Aggregation or Composition , not Encapsulation.
- Which Rural Bank launched a new deposit scheme “Vikas Siri Sampat-1111”? 
- Where did ISRO successfully conduct its second short hot test of the semicryogenic engine in April 2025? 
- HDFC Bank inaugurated its first branch in which country in October 2024? 
- Which country has declared National Emergency in view of Cyclone Gabriel? 
- The Tropic of Cancer passes through how many Indian states? 
- Which of the following statements is true about Meera Syal's BAFTA fellowship and upcoming projects? - I. Meera Syal will receive the award fo... 
- Which international sporting event does India aspire to host, as mentioned by PM Modi during his Independence Day speech? 
- With which state government did Google sign a Memorandum of Understanding (MoU) to provide AI-led solutions across key sectors? 
- Railways to renovate 1,000 small stations under which of the following central government? 
- Who became the first Latin American recipient of the Council of Europe's rights prize in 2024?