Program Translation Flow in C: Match Processor Stage to Its Output List I (Stages) A. Preprocessor B. Compiler C. Linker List II (Outputs) 1. Source code file (expanded/processed) 2. Executable machine code 3. Relocatable object code

Difficulty: Easy

Correct Answer: A-1, B-3, C-2

Explanation:


Introduction / Context:
Building a C program goes through multiple stages. Understanding what each stage emits helps in debugging, build optimization, and interpreting toolchain outputs such as .i, .o, and .exe files.


Given Data / Assumptions:

  • Typical GCC/Clang-like toolchain behavior.
  • Separate preprocessing, compiling/assembling, and linking steps.
  • Static linking assumed for the final executable conceptually.


Concept / Approach:

The preprocessor handles macro expansion, includes, and conditional compilation, producing processed source (often with extension .i). The compiler translates the processed source to object code (.o or .obj). The linker resolves external references and produces an executable image.


Step-by-Step Solution:

Preprocessor → expanded source file ⇒ A-1.Compiler → relocatable object code ⇒ B-3.Linker → executable machine code ⇒ C-2.


Verification / Alternative check:

Invoking toolchain phases explicitly (e.g., gcc -E, -c, and link step) yields .i, .o, and an executable, matching the mapping.


Why Other Options Are Wrong:

Assigning the preprocessor to produce machine code or the linker to produce source contradicts the compilation pipeline.


Common Pitfalls:

Confusing the compiler and assembler outputs; many modern compilers perform both steps invisibly but the result is still relocatable object code before linking.


Final Answer:

A-1, B-3, C-2

More Questions from Matching Questions

Discussion & Comments

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