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:
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:
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