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:
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:
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
Discussion & Comments