Open In App

GATE | GATE-CS-2004 | Question 9

Like Article
Like
Save
Share
Report

Consider a program P that consists of two source modules M1 and M2 contained in two different files. If M1 contains a reference to a function defined in M2, the reference will be resolved at
(A) Edit-time
(B) Compile-time
(C) Link-time
(D) Load-time


Answer: (C)

Explanation:  

Note:
Static linking is done at link-time, dynamic linking or shared libraries are brought in only at runtime.

(A) Edit-time : Function references can never be given/determined at edit-time or code-writing time. Function references are different from function names. Function names are used at edit-time and function references are determined at linker-time for static libraries or at runtime for dynamic libraries.

(B) Compile-time : Compile time binding is done for functions present in the same file or module.

(C) Link-time : Link time binding is done in the linker stage, where functions present in separate files or modules are referenced in the executable.

(D) Load-time : Function referencing is not done at load-time.

Hence, correct answer would be (C).

 

This solution is contributed by Vineet Purswani.

Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads