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.
A train can cross a pole, a bridge of 510 meter long and platform of 480 meter long in 15 seconds, _____ seconds and 31 seconds, respectively.
Th...
A train travels at an average speed of 100 km per hour without stoppage and with stoppages it covers the same distance at an average speed of 80 km/hr. ...
Train 'X' leaves Pune heading to Nagpur at 7:00 a.m. At 9:00 a.m., Train 'Y' leaves Nagpur for Pune, traveling at 70 km/h. The trains meet at 2:00 p.m. ...
A train 200 metre long takes 30 sec to cross a man running at a speed of 4 km/hr in the direction opposite to that of train. What is the speed of the tr...
A train travelling at the speed of 72 km/hr crosses another train, having 20 meters less length and travelling in opposite direction at the speed of 54 ...
Two trains of equal lengths take 20 seconds and 30 seconds respectively to cross a telegraph post. If the length of each train be 240 metres, in what ti...
A train can cross a pole in 6 seconds while it can cross a 240 metres long platform in 18 seconds. Find the time (in hours) taken by the train to cover ...
Length of a train is two-thirds of the length of a platform. If the train crosses the platform in 45 seconds, then find the time taken by train to cros...
Time is taken by two trains running in opposite directions to cross a man standing on the platform in 24 seconds and 14 seconds respectively. It took 20...
A train Lucknow Express leaves station A at 4 am and reaches station B at 7 am. Another train Kanpur Express leaves station B at 6 am and reaches statio...