Question
Which OOP concept ensures that the internal details of
an object are hidden from the outside world, providing a clear interface for interaction?Solution
Encapsulation is a cornerstone of OOP that enforces data hiding by restricting direct access to an object’s internal state. 1. Data Protection: By using access modifiers (e.g., private, protected), encapsulation shields sensitive data from external manipulation. 2. Clear Interfaces: Through getter and setter methods, encapsulation provides controlled interaction with an object’s data, ensuring integrity and security. 3. Modularity: Encapsulation helps developers manage code complexity by compartmentalizing data and behavior within distinct classes. Thus, encapsulation creates a robust framework for managing dependencies and ensuring secure object interactions. Why Other Options Are Incorrect: • A) Abstraction: Focuses on hiding implementation details but differs by emphasizing interface design. • B) Polymorphism: Deals with dynamic behavior and method variability, unrelated to data hiding. • D) Inheritance: Describes property/method sharing between classes, not encapsulation. • E) Composition: Involves constructing objects using other objects, unrelated to access control.
At what rate percent compounded yearly will Rs. 5000 amount to Rs 5408 in 2 yrs?
A sum of Rs. 2100 is invested at simple interest for 2 years. If the rate interest for first year is 15% p.a. while 25% p.a. for second year, then find ...
Amit took a loan of Rs. 36000 at 10% per annum simple interest for 3 years. He invested the full amount in a scheme offering 13% p.a. simple interest fo...
The difference between the simple interest and the compound interest compounded annually at the same rate on a sum of money at the end of two years is R...
A sum of Rs. 3500 is invested at simple interest for 2 years. If the rate interest for first year is 10% p.a. while 18% p.a. for second year, then find ...
At what % of simple interest per annum will Rs. 400 amount to Rs. 520 in five years?
A sum of ₹8000 is invested at 10% per annum for 2 years. Find the difference between the compound interest (compounded annually) and the simple intere...
The simple interest received on a certain sum is Rs. 450 less than the sum invested. If the sum was invested at 10% p.a. for 5 years, then find the simp...
A invested Rs. ‘x’ in a scheme offering compound interest of 35% p.a. compounded annually. If at the end of 2 years, interest received by A was Rs. ...
- A person invests Rs. 800 for 2 years at a simple interest rate of ‘x%’ per annum, Rs. 450 for 4 years at a simple interest rate of (x – 2)% per annum...