Relocatable program forms Which statement correctly characterizes a relocatable program?

Difficulty: Medium

Correct Answer: It consists of a program plus the information needed for relocation by a loader or linker.

Explanation:


Introduction / Context:
Relocation is central to modular software and modern operating systems. Object modules produced by assemblers and compilers include metadata that allows a linker or loader to adjust addresses when placing code and data into memory. This question distinguishes between absolute, relocatable, and self relocating forms.



Given Data / Assumptions:

  • Absolute programs contain fixed addresses and must load at a specific location.
  • Relocatable programs carry relocation records so addresses can be adjusted.
  • Self relocating programs include routines that modify their own references during loading or start up.


Concept / Approach:

A relocatable program is best defined as code plus relocation information that an external loader or linker uses to compute final addresses. This enables the same object module to load at different base addresses without recompilation. By contrast, an absolute program (option a) is not relocatable, and a self relocating program (option c) is a specialized case distinct from standard relocatable objects.



Step-by-Step Solution:

Eliminate option a because it describes absolute code.Recognize option c as a different category: self relocating, not the generic definition.Select option b, which matches standard object module practice.


Verification / Alternative check:

Examine typical object file formats (for example, COFF, ELF, OMF). They store relocation entries that a linker or loader applies, evidencing option b.



Why Other Options Are Wrong:

a: contradicts the idea of relocation. c: describes a specific mechanism, not the general definition. d: cannot be true because a is false. e: not applicable because b is correct.



Common Pitfalls:

Confusing position independent code with relocatable objects; assuming self relocation is the norm in modern systems where loaders handle relocation.



Final Answer:

It consists of a program plus the information needed for relocation by a loader or linker.

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion