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.
Could is the past form of ......
Select the sentence with correct punctuation and capitalisation.
Select the sentence with correct punctuation and capitalisation.
Three Idiots.....really a watchable movie.
Do you always go to school ..... foot?
Identify the form of each sentence given here from among the choices given below it :
We went to the park and played games.
Fill in the blank with Suitable option.
Turn the lights ______, I want to go to bed.
No sooner did the bell ring …….. the students dispersed.
A) Diligent             B) Lazy          C) Despair       D) Hatch
...Nandita as well as her sister ……. going to be present at the function.