Question
In OOP, which concept allows a subclass to provide a
specific implementation of a method already defined in its parent class?Solution
Method overriding allows a subclass to redefine a method of its parent class to provide more specific behavior. 1. Dynamic Binding: Overriding enables dynamic (runtime) polymorphism, allowing a subclass method to be invoked via a parent class reference. 2. Specialization: It customizes inherited behavior, making objects more precise in functionality. For example, a generic draw() method in a Shape class can be overridden by a Circle subclass to draw circles. 3. Liskov Substitution Principle: Overriding ensures subclass objects can seamlessly replace parent class objects without affecting system behavior. Option C exemplifies OOP’s adaptability and extendability by redefining methods at runtime. Why Other Options Are Incorrect: • A) Encapsulation: Manages data access, unrelated to redefining methods. • B) Method Overloading: Involves multiple methods with the same name but different parameters, unrelated to inheritance. • D) Abstraction: Focuses on defining essential features, unrelated to runtime behavior customization. • E) Composition: Relates to object containment, not method redefinition.
A starts business with Rs.9000 and after 8 months, B joins with A as his partner. After a year, the profit divided in the 4:5. What is B’s contributi...
Anuj and Bheem began a business by investing Rs. Z and Rs. (Z + 2,500), respectively. After operating together for 16 months, Anuj withdrew from the bus...
Palash invest twice the sum invested by Vicky and withdraws half of the sum after 4 months and again withdraws half of the remaining sum after 2 months....
A started a business with an investment of Rs.1500. After some months, B joins the business with an investment of Rs.3000 and after two more months C jo...
A and B started a business by investing Rs.500 and Rs.600 respectively. After 4 months, A increased his investment by Rs.900. Find the ratio of annual ...
A, B and C enter into a partnership with a capital in which A’s contribution is Rs. 10,000. If out of a total profit of Rs. 2000, A gets Rs. 800 a...
A invests Rs. (P + 800). After four months, B joins with Rs. 3P. If the ratio of B’s annual profit share to A’s is 6:5, find (P − 200).
A and B started a retail store with initial investments in the ratio 7:8 and their annual profits were in the ratio 3:4. If A invested the money for 9 m...
In a business there are two partners ‘P’ and ‘Q’. ‘P’ started the business with the capital of Rs. 20000 and after 3 months ‘Q’ joined h...
Pooja and Priya started a business investing Rs. 3,600 and Rs. 6,000 respectively. Priya left the business after a few months. At the end of the year, t...