GATE / CS ARCHIVE

GATE CSE 2004 / QUESTION 9

Resolving an external function reference

Compiler Design · Compiler Phases, Linking & Loading · Full GATE CSE 2004 paper

GATE 2004, Q9 1 mark · MCQ
Not in GATE 2027 syllabusReport issue

Compiler Phases, Linking & Loading

Question 9, GATE 2004: A program has separately stored source modules M1 and M2. M1 refers to a function defined in M2. At what stage is this reference resolved in the conventional separate-compilation model?
Options:
(A) Edit time
(B) Compile time
(C) Link time
(D) Load time
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. With conventional separate compilation and static linking, each module produces an object file with symbol definitions/references. The linker matches the external reference in M1 to the definition in M2, so link time, C.

2. Dynamic loading can defer binding, but is not the default compilation model stated here.

3. Teaching check: Compilation can emit an unresolved external symbol into M1’s object file. Linking has access to both objects and supplies the address from M2. Editing only changes text; loading places an already linked image into memory under the assumed static-binding model.

Original paper, page 2