Bird
0
0

What will be the output of the following commands?

medium📝 Predict Output Q4 of 15
C - Basics and Execution Environment
What will be the output of the following commands?
gcc -E file.c -o file.i
gcc -S file.i -o file.s
Afile.i contains object code; file.s contains executable
Bfile.i contains preprocessed code; file.s contains assembly code
Cfile.i contains source code; file.s contains preprocessed code
Dfile.i contains assembly code; file.s contains object code
Step-by-Step Solution
Solution:
  1. Step 1: Analyze gcc -E command

    'gcc -E' runs the preprocessor and outputs preprocessed source code to file.i.
  2. Step 2: Analyze gcc -S command

    'gcc -S' compiles source (here file.i) to assembly code, outputting file.s.
  3. Final Answer:

    file.i contains preprocessed code; file.s contains assembly code -> Option B
  4. Quick Check:

    Preprocessing = file.i, Assembly = file.s [OK]
Quick Trick: gcc -E outputs preprocessed code; gcc -S outputs assembly [OK]
Common Mistakes:
  • Confusing object code with preprocessed code
  • Thinking file.s is executable
  • Mixing source and assembly files

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes