MCQ Hive stays free thanks to ads. Please disable your ad blocker for this site so content and features keep working.
Fundamental Programming
Translation & Execution
Beginner
Q
A program declares a function prototype and calls it, but the function body is never defined anywhere. When is the 'undefined reference' error reported?
AAt compile time
BAt preprocessing time
CAt link time
DAt run time
Correct Answer:
C. At link time
Explanation:
The compiler accepts the call because the prototype exists. Only the linker discovers that no definition exists.
ALSO KNOW (related points):
• Which statement about an interpreter is correct? → It translates and executes code statement by statement, so an error on a later line may not be reported until execution reaches it
• In a C++ build, which component resolves calls to functions defined in other object files or libraries? → Linker