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.
20 ×33 + 12 × 23 - 40 ÷ 15-1 + ? = 50
12% of 10% of 15% of 5000 + (12 x 15) = ?
(47.5 ÷ 9.5) × (78.5 ÷ 15.7) + 475 = ? + 15% of 150
[(15)³ × (8)²] ÷ (90 × 6) = ?²
- What will come in place of (?) in the given expression.
(18.5 × 2) + (3.5 × 4) = ? - Find the simplified value of the given expression:
10 of 5 ÷ 4 × 2² + √25 – 8 The speed of the stream is 10 km/h. Boat ‘A’ covers 110 km distance against the stream in 11 hours and boat ‘B’ covers 65 km distance against th...
33 × ?2 – 6 × 5 = 3270
1885 ÷ 64.98 + 7.29 + ? = 69.09
What will come in the place of question mark (?) in the given expression?
737 + 149 - ?²- 367 = 14 X 25