Linker Loader Questions | Operating Systems

Question 1
In a resident – OS computer, which of the following systems must reside in the main memory under all situations?
A
Assembler
B
Linker
C
Loader
D
Compiler
Question 1 Explanation: 
The loader is a program that is responsible for loading the object program from the secondary memory into the main memory for execution of the program. The loader must resides in main memory.
Question 2
A system program that combines the separately compiled modules of a program into a form suitable for execution
A
Assembler
B
Linking loader
C
Cross compiler
D
Load and go
Question 2 Explanation: 
linking loader : A loader which combines the functions of a relocating loader with the ability to combine a number of program segments that have been independently compiled into an executable program.
Question 3
In Distributed system, the capacity of a system to adapt the increased service load is called __________ .
A
Tolerance
B
Scalability
C
Capability
D
Loading
Question 3 Explanation: 
Scalability is the capacity of distributed system to adopt the increased load in Distributed System
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 is a computer program that takes one or more object files generated by a compiler and combines them into one executable program, library file or another object file
linker and loader

Principles tasks of the linker are:
  • Resolve external references among separately compiled program units.
  • Relocate code and data relative to the beginning of the program.
-Assembler translate assembly language to machine code.
-Loader enforces access-control restrictions on system libraries
Question 5
​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 5 Explanation: 
Dynamic linking is used to reduce space consumption on disk and memory and it also reduce the cost of software update.
I. Reduction in overall program execution time - True
II. Reduction in overall space consumption in memory - False
III. Reduction in overall space consumption on disk- False
IV. Reduction in the cost of software updates- False
Question 6
Absolute loader demands that the programmer needs to know the :
A
Start address of the available main memory
B
Total size of the program
C
Actual address of the data location
D
Absolute values of the operands used
Question 6 Explanation: 
  • The absolute loader is a kind of loader in which relocated object files are created, loader accepts these files and places them at a specified location in the memory.
  • This type of loader is called absolute loader because no relocating information is needed, rather it is obtained from the programmer or assembler.
  • The starting address of every module is known to the programmer, this corresponding starting address is stored in the object file then the task of loader becomes very simple that is to simply place the executable form of the machine instructions at the locations mentioned in the object file.
  • In this scheme, the programmer or assembler should have knowledge of memory management. The programmer should take care of two things:
    • Specification of starting address of each module to be used. If some modification is done in some module then the length of that module may vary. This causes a change in the starting address of immediate next modules, it's then the programmer's duty to make necessary changes in the starting address of respective modules.
    • While branching from one segment to another the absolute starting address of respective module is to be known by the programmer so that such address can be specified at respective JMP instruction.
There are 6 questions to complete.
Question 1
Relocation bits used by relocating loader are specified by
A
Relocating loader itself
B
Linker
C
Assembler
D
Macro Processor
Question 1 Explanation: 
  • Relocation bits used by relocating loader are specified or generated by linker
  • A linker or link editor is a computer 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.
  • Linking: Combining two or more object programs into a single unit (“load module”).
  • Loading: Bringing an object program (load module) into memory for execution.
  • Relocation: Modifying an object program so that it can be loaded from a location different from the one originally specified.
Refer : https://www.albany.edu/~csi402/pdfs/lect_08.pdf
Question 2
The most powerful parser is
A
SLR
B
LALR
C
Canonical LR
D
Operator Precedence
Question 2 Explanation: 
Connonical (CLR) is the most powerful Parsers among all the LR(k) Parsers or SLR.
LR > LALR > SLR
 most powerful parser is CLR
Question 3
A linker is given object module for a set of programs that were compiled separately. What information need not be included in an object module?
A
Object code
B
Relocation bits
C
Names and locations of all external symbols defined in the object module
D
Absolute addresses of internal symbols
Question 3 Explanation: 
Option(A) : Object code is trivially there is an object module.
Option(B) : Relocation bits must be there if we need to have relocation capability.
Option(C) : For linker to link external symbols it must know the location of all external symbols.
In object module it include Names and locations of all external symbols defined in the object module
Option(D) : Absolute addresses of internal symbols information need not be included in an object module
Question 4
Which of the following is the first module of a language processing system?
A
Preprocessor
B
Loader
C
Compiler
D
Linker
Question 4 Explanation: 
compiler phases
Question 5
OLE, a microsoft's component document technology, means
A
Overlay linking and exchange
B
Online linking and embedding
C
Open learning exchange
D
Object linking and embedding
Question 5 Explanation: 
Object Linking & Embedding (OLE) Refer this link for more information :
https://en.wikipedia.org/wiki/Object_Linking_and_Embedding
Question 6
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 6 Explanation: 
Statement I  - A function of a linker is to combine several object modules into a single load module - True
linker or link editor is a computer system 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

Statement II -  A function of a linker is to replace absolute references in an object module by symbolic - False
linker always generate relocatable address 
Question 7
The process of assigning load addresses to the various parts of the program and adjusting the code and data in the program to reflect the assigned addresses is called _______.
A
Symbol resolution
B
Parsing
C
Assembly
D
Relocation
Question 7 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
  • 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 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.
Question 8
Object modules generated by assembler that contains unresolved external references are resolved for two or more object module by a/an
A
Operating system
B
Loader
C
Linker
D
Compiler
Question 8 Explanation: 
  • In a single file program, while producing the object file, all references to labels are replaced by their corresponding addresses by the assembler.
  • Incase of multi-file program, if there are any references to labels defined in another file, the assembler marks these references as "unresolved".
  • When these object files are passed to the linker, the linker determines the values for these references from the other object files, and patches the code with the correct values.
Question 9
Which of the following can be accessed by transfer vector approach of linking ?
A
External data segments
B
External subroutine
C
Data located in other procedure
D
All of the above
Question 9 Explanation: 
External subroutines are routines that are created and maintained separately from the program that will be calling them.
Question 10
Object code is the output of ______.
A
Operating System
B
Compiler or Assembler
C
Only Assembler
D
Only compiler
Question 10 Explanation: 
  • Source code is  programming statements that are created by a programmer with a text editor or a visual programming tool and then saved in a file.
  • Object code generally refers to the output, a compiled file, which is produced when the Source Code is compiled with a C compiler.
  • The object code file contains a sequence of machine-readable instructions that is processed by the CPU in a computer.
Question 11
In an absolute loading scheme, which loader function is accomplished by a loader ?
A
Re-allocation
B
Allocation
C
Linking
D
Loading
Question 11 Explanation: 
  • In an absolute loading scheme, Loading function is accomplished by the loader
  • Loader loads the executable code into memory, program and data stack are created and registers will initialized
  • Reallocation change relocatable address into absolute address
Question 12
The linker :
A
Is similar to interpreter
B
Uses source code as its input
C
Is required to create a load module
D
None of the above
Question 12 Explanation: 
Linker is a 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.

Notes :
linker and loader
There are 12 questions to complete.
Question 1
In a resident – OS computer, which of the following systems must reside in the main memory under all situations?
A
Assembler
B
Linker
C
Loader
D
Compiler
Question 1 Explanation: 
The loader is a program that is responsible for loading the object program from the secondary memory into the main memory for execution of the program. The loader must resides in main memory.
Question 2
A system program that combines the separately compiled modules of a program into a form suitable for execution
A
Assembler
B
Linking loader
C
Cross compiler
D
Load and go
Question 2 Explanation: 
  • A system program that combines the separately compiled modules of a program into a form suitable for execution is linking loader.
  • Linking Loader performs all linking and relocation operations, including automatic library search, and loads the linked program into memory for execution.
  • Linking Loader is Suitable when a program is reassembled for nearly every execution.
  • Linking loaders perform linking operations at load time.
  • There is no need of relocating loader
  • The Loading may requires two passes.
  • The two passes of a linking loader are quite similar to the two passes of an assembler:
    Pass 1 : Assigns addresses to all external symbols.
    Pass 2 : Performs the actual loading, relocation, and linking.
Question 3
In Distributed system, the capacity of a system to adapt the increased service load is called __________ .
A
Tolerance
B
Scalability
C
Capability
D
Loading
Question 3 Explanation: 
Scalability is the capacity of distributed system to adopt the increased load in Distributed System
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: 
The linker is a computer program that takes one or more object files generated by a compiler and combines them into one executable program, library file, or another object file
linker and loader

Principles tasks of the linker are:
  • Resolve external references among separately compiled program units.
  • Relocate code and data relative to the beginning of the program.
-Assembler translate assembly language to machine code.
-Loader enforces access-control restrictions on system libraries
Question 5
​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 5 Explanation: 
Dynamic linking is used to reduce space consumption on disk and memory and it also reduce the cost of software update.
I. Reduction in overall program execution time - True
II. Reduction in overall space consumption in memory - False
III. Reduction in overall space consumption on disk- False
IV. Reduction in the cost of software updates- False
There are 5 questions to complete.
Question 1
Resolution of externally defined symbols is performed by____
A
Linker
B
Loader
C
Compiler
D
Editor
Question 1 Explanation: 
The linker resolves symbol references by associating each ref with exactly one symbol definition from the symbol tables of its input relocatable obj files. Symbol resolution is easy for references to local variables that are defined in the same module as the ref.

Resolving ref to global symbols is trickier. When the compiler encounters a symbol (either a var or func name) that is not defined in the current module, it assumes that it is defined in some other module, generally a linker symbol table entry, and leaves it for the linker to handle. If the linker is unable to find a def for the referenced symbol in any of its input modules, it prints an error msg and terminates.
There is 1 question to complete.

Leave a Reply