Match List I with List II
| List I |
List II |
| A. Overloading |
I. Since function call is resolved during run time, the execution is Slow. |
| B. Early binding |
II. Since function call is resolved during compilation time, the execution is much faster. |
| C. Overriding |
III. Supports compile-time polymorphism. |
| D. Late Binding |
IV. Supports run-time polymorphism. |
Choose the correct answer from the options given below:
1. A-III, B-II, C-I, D-IV ✓ Correct
2.A-IV, B-II, C-III, D-I
3.A-III, B-I, C-IV, D-II
4.A-IV, B-I, C-III, D-II
Solution
The Correct Answer is: Option 1: A-III, B-II, C-I, D-IV
Detailed Explanation:
A. Overloading:
- Overloading refers to the ability to define multiple functions with the same name but different parameters within a class.
- This is resolved during compile-time, meaning the compiler identifies which function to call based on the number and type of arguments passed.
- Thus, overloading supports compile-time polymorphism.
- Correct Match: III
B. Early Binding:
- Early binding refers to the resolution of function calls during compile-time rather than runtime.
- It ensures faster execution as the function to be executed is determined beforehand during compilation.
- This is an efficient method since it avoids runtime overhead.
- Correct Match: II
C. Overriding:
- Overriding occurs when a subclass provides a specific implementation for a method that is already defined in its parent class.
- This process happens during runtime, as the decision on which method to call depends on the object's type.
- Since function calls are resolved at runtime, the execution is comparatively slower.
- Correct Match: I
D. Late Binding:
- Late binding refers to the resolution of function calls during runtime.
- This supports run-time polymorphism, as the decision of which method to invoke is made based on the type of the object at runtime.
- Although flexible, it is slower than early binding due to the runtime overhead.
- Correct Match: IV