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.
169, 224, 293, 385, 497, 629
Find the wrong number in the given number series.
20, 33, 50, 69, 93, 121
25Â Â Â 26Â Â Â Â 28Â Â Â Â 32Â Â Â Â 42Â Â Â Â 56
Find the wrong number in the given number series.
8, 12, 23, 40, 66, 103
8137, 5405, 3669, 2701, 2201, 1997
Find the wrong number in the given number series.
78, 66, 51, 39, 20, 12
2824Â Â Â Â 2314Â Â Â Â Â 1973Â Â Â Â 1759Â Â Â Â 1634Â Â Â Â 1574
In each of the following number series, one term is wrong. Find the wrong term.
3, 7, 13, 21, 31, 42, 57
Find the wrong term in the given series below.
2847, 2954, 2799, 3088, 2727, 3256
Find the wrong number in the given number series.
2, 5, 10, 17, 26, 38, 50