Linker-and-Loader

Question 1

Choose the correct alternatives (more than one may be correct) and write the corresponding letters only: A “link editor” is a program that:

A
matches the parameters of the macro-definition with locations of the parameters of the macro call
B
matches external names of one program with their location in other programs
C
matches the parameters of subroutine definition with the location of parameters of subroutine call
D
acts as link between text editor and the user
E
acts as a link between compiler and user program
Question 1 Explanation: 
Linked editor can be able to perform
1) external symbol resolution
2) relocation
Question 2
Which of the following is a Pass 1 task in a typical assembler?
A
Generate data
B
Generate instructions
C
Look up value of symbols
D
Determine length of machine instructions
Question 2 Explanation: 
Generating data,generating instructions and look up values of symbols are done in pass 2 of assembler. But Determining length of machine instructions is done in pass 1.
Question 3
Which statement is wrong ?
A
If linked origin ≠ translated origin, relocation must be performed by the linker
B
If load ≠ linked origin, the loader must perform relocation
C
A linker always perform relocation, whereas some loaders do not
D
None of these
Question 3 Explanation: 
Relocation is the process of assigning load addresses for position-dependent code and data of a program and adjusting the code and data to reflect the assigned addresses.
A linker usually performs relocation in conjunction with symbol resolution, the process of searching files and libraries to replace symbolic references or names of libraries with actual usable addresses in memory before running a program.
Relocation is typically done by the linker at link time, but it can also be done at load time by a relocating loader, or at run time by the running program itself. Some architectures avoid relocation entirely by deferring address assignment to run time; this is known as zero address arithmetic
A linker or link editor is a computer utility program that takes one or more object files generated by a compiler or an assembler and combines them into a single executable file, library file, or another 'object' file.
A simpler version that writes its output directly to memory is called the loader, though loading is typically considered a separate process
Question 4
Which of the following are the principles tasks of the linker?
I. Resolve external references among separately compiled program units.
II. Translate assembly language to machine code.
III. Relocate code and data relative to the beginning of the program.
IV. Enforce access-control restrictions on system libraries
A
I and II
B
I and III
C
II and III
D
I and IV
Question 4 Explanation: 
Linker:
A linker or link editor is a computer utility program that takes one or more object files generated by a compiler and combines them into a single executable file, library file, or another 'object' file.
Principles:
1. Resolve external references among separately compiled program units
2. Relocate code and data relative to the beginning of the program.
→ Assembler, Translate assembly language to machine code.
Question 5
Which of the following statement(s) regarding a linker software is/are true ?
I A function of a linker is to combine several object modules into a single load module.
II A function of a linker is to replace absolute references in an object module by symbolic references to locations in other modules.
A
Only I
B
Only II
C
Both I and II
D
Neither I nor II
Question 5 Explanation: 
TRUE: A function of a linker is to combine several object modules into a single load module. → A linker combines one or more object files and possible some library code into either some executable, some library or a list of error messages.
FALSE: A function of a linker is to replace absolute references in an object module by symbolic references to locations in other modules.
Question 6
​Which of the following is not typically a benefit of dynamic linking?
I. Reduction in overall program execution time.
II. Reduction in overall space consumption in memory.
III. Reduction in overall space consumption on disk.
IV. Reduction in the cost of software updates.
A
I and IV
B
I only
C
II and III
D
IV only
Question 6 Explanation: 
TRUE: Reduction in overall program execution time.
FALSE: Reduction in overall space consumption in memory.
FALSE: Reduction in overall space consumption on disk.
FALSE: Reduction in the cost of software updates.
Note: Except statement-I remaining all statements are not related to dynamic linking.
There are 6 questions to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access