Question
Which feature of OOP allows hiding implementation
details while showing only the necessary functionality?Solution
Abstraction allows a programmer to focus on essential features of an object while ignoring the underlying complexity. It defines the "what" of functionality without exposing the "how." For example, an interface Vehicle may have a method drive() without specifying how it operates. Different classes like Car and Bike can implement drive() in their way while hiding their internal details. Abstraction is achieved using abstract classes and interfaces. It simplifies system design by providing a clear separation of concerns, enabling developers to focus on high-level interactions rather than low-level details. Why Other Options Are Wrong Option A : "Inheritance" Inheritance enables code reuse by sharing functionality but does not inherently involve hiding implementation details. Option C : "Encapsulation" Encapsulation protects and restricts access to data but is more concerned with access control than hiding implementation logic. Option D : "Polymorphism" Polymorphism deals with dynamic method binding and does not focus on hiding details. Option E : "Composition" Composition models "whole-part" relationships and is unrelated to abstraction.
βAβ can do a piece of work in 10 days. βBβ can do 70% of the same work in 20 days. If they work together for the entire time and get paid Rs.108...
- Pipe βXβ can fill a tank 15 minutes faster than Pipe βYβ. If both are opened together, they can fill the tank in 18 minutes. If 180 litres of water...
A 250 litres mixture contains only water and phenyl in the ratio 3:2, respectively. If 60 litres of this mixture is replaced with 90 litres of alcohol, ...
A certain number of men, represented as 'm', can finish a task in 40 days. However, if there were 15 additional men, the same task would be completed in...
βAβ can do a piece of work in 10 days. βBβ can do 80% of the same work in 12 days. If they work together for the entire time and get paid Rs.120...
Gagan can do a piece of work in 14 days. Magan is 40% more efficient than Gagan. How many days will Magan and Gagan together complete the work?
Aaru Swati and Rajni can finish a work in 4 days if they work together. However, Aaru alone will take 9 days to complete the work, and Swati alone will ...
A can complete a work in 20 days and B can complete it in 30 days. They work together for 6 days, then B leaves. In how many total days will the work be...
A task can be completed in 10 days by a team of 6 men and 8 boys. The same task can also be completed in 2 days by 26 men and 48 boys. How long will it ...
20 men take 15 days to finish some work. 24 women can finish the same work in 20 days. If the ratio of efficiencies of each man and woman is p:q, respec...