Difficulty: Easy
Correct Answer: Only I is correct.
Explanation:
Introduction:
Different paradigms (procedural vs. object-oriented) influence how and when a call to a function is bound to its actual implementation. This question checks your understanding of compile-time (early) versus runtime (late) binding across these styles.
Given Data / Assumptions:
Concept / Approach:
In procedural programs, the target of a function call is generally determined at compile/link time. In OOP, while many calls are also resolved at compile time, virtual functions are deliberately dispatched at runtime based on the object’s dynamic type. Therefore, saying “all” calls in OOP are compile-time is incorrect.
Step-by-Step Solution:
1) Evaluate I: true in the typical sense—procedural calls are early-bound.2) Evaluate II: false—virtual member functions in OOP are late-bound (dynamic binding).3) Since only I holds universally, choose “Only I is correct.”4) Note that in OOP non-virtual calls and inline/templated calls still resolve at compile time; “all” is the failing word.
Verification / Alternative check:
Write a base/derived example with a virtual function; the actual function selected depends on the runtime type, confirming late binding exists in OOP.
Why Other Options Are Wrong:
Only II / Both correct / Both incorrect: each contradicts the existence of virtual dispatch in OOP and the general early binding in procedural code.
Common Pitfalls:
Equating OOP with always-late binding. In C++, only virtual functions called via a base interface dispatch at runtime; others are still early-bound.
Final Answer:
Only I is correct.
Discussion & Comments