Question
Which of the following best describes Abstraction in
Object-Oriented Programming (OOP)?Solution
Abstraction is a core concept of OOP that focuses on hiding unnecessary implementation details while exposing only the essential features of an object. This is achieved through abstract classes and interfaces. For instance, a Car class might expose methods like start() or drive() without detailing how the engine works internally. Abstraction simplifies the development process by allowing programmers to focus on high-level logic rather than low-level complexities. It also enhances security by preventing direct access to sensitive parts of an application. Why Other Options Are Incorrect : 2. Restricting access to certain parts of an object to protect data : This describes Encapsulation , not Abstraction. Encapsulation involves bundling data and methods together and using access modifiers to control visibility. 3. Combining different objects into a single unit to represent a relationship : This describes Aggregation , where objects are linked to represent "has-a" relationships, like a Library having Books. 4. Allowing multiple classes to share the same method name but with different implementations : This defines Polymorphism , specifically method overriding or overloading, and is unrelated to abstraction. 5. Establishing a parent-child relationship between classes : This is Inheritance , where one class derives from another, enabling code reuse and hierarchy building.
- 'Amit', 'Ravi', and 'Neha' can finish a piece of work in 66, 99, and 132 days respectively. They all started the work, but Amit left 8 days before the work...
Ratio of the work done by P, Q and R in one day is 7:4:9 respectively. They all together can complete the work in 44 days. Q and R worked on it for 30 d...
A 210 litres mixture contains only water and phenyl in the ratio 3:2, respectively. If 60 litres of this mixture is replaced with 100 litres of alcohol,...
- A firm assigned 10 technicians to complete an assignment in 30 days. After 12 days of work, 4 technicians were moved to another location. What is the exten...
- Suppose D, E and F can do a piece of work individually in 18, 27 and 36 days respectively. If they combine and work for 4 days, what percentage of work wou...
A can complete a work in 12 days and B can complete the same work in 18 days. They work together for 4 days and then B leaves. In how many more days wil...
A man, a woman and a boy can do a work in 3, 2, 6 days respectively. How many children were required with 1 man and 1 woman to complete the same work in...
βXβ and βYβ together can complete a work in 10 days, while βYβ and βZβ together can complete the work in 8 days. If βYβ takes 12 day...
- 25 employees working 9 hours a day take 20 days to complete a project. How many employees working for 8 hours a day are needed to complete twice the given ...
A team of 12 men and 18 women can complete a construction project in 24 days. If 6 women alone can do the same project in 144 days, how many days will 4...