Start learning 50% faster. Sign in now
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.
Statements:
No Planet is a Moon
Some Moon are Star
All Axis are Planet
Only a few Sun are Axis
Statements: No swan is a penguin.
Some penguins are kingfisher.
Some tyres may be flowers. Some jungles are not rains. Some flowers are petals.
Statement: All fruits are vegetables
Some vegetables are potatoes
Statements:
All Skirts are Shirts
Some Shirts are not Socks.
All Socks are Belts.
Conclusions:
Statements:
Only a few Products are Price.
Only Prices are Place.
No Price is Promotion.
Conclusion
Statements:
No pen is pencil.
Some pencil is eraser.
All eraser is box.
Some box is scale.
Conclusions:
...Statements:
Only a few Apples are Kiwis.
All Kiwis are Pears.
No Pear is a Banana.
Conclusions: