Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

GATE | GATE-CS-2004 | Question 9

  • Last Updated : 28 Jun, 2021

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.

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

(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

My Personal Notes arrow_drop_up
Recommended Articles
Page :