Compilation Artifacts Which statement about object code is correct?

Computer Science Operating Systems Concepts Difficulty: Easy
Choose an option
  • A
    It is ready to execute as-is
  • B
    It is the output of compilers, but not assemblers
  • C
    It must be loaded (and possibly linked/relocated) before execution
  • D
    It must be rewritten by a programmer before execution
  • E
    None of the above

Answer

Correct Answer: It must be loaded (and possibly linked/relocated) before execution

Explanation

Introduction / Context:Software toolchains transform human-readable source into machine-usable forms. Understanding the difference between object code and executable images clarifies the roles of compilers, assemblers, linkers, and loaders.

Given Data / Assumptions:

  • Object code is typically relocatable and may contain unresolved symbols.
  • Executables are load modules with relocation resolved (or prepared for dynamic linking).

Concept / Approach:Object files are intermediate artifacts. A linker combines one or more object files and libraries, resolves symbols, and produces an executable or shared library. A loader then places the program in memory and transfers control.

Step-by-Step Solution:Source → compile/assemble → object (.o/.obj).Link objects → executable image (.exe, ELF, Mach-O).Loader maps the image into memory and starts execution.

Verification / Alternative check:Toolchain manuals show that both compilers and assemblers emit object files, and executables are produced after linking; relocation info confirms the need for loading/relocation.

Why Other Options Are Wrong:Option A confuses object code with a final load module.Option B is false—assemblers also produce object code.Option D is incorrect; object code is processed by tools, not rewritten manually.

Common Pitfalls:

  • Assuming a single object file is always runnable; many require libraries.
  • Confusing static and dynamic linking stages.

Final Answer:It must be loaded (and possibly linked/relocated) before execution.

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