GCC Compiler Questions & Answers – Various Options -1

DigitalOcean Referral Badge DigitalOcean Referral Badge

1.

Which one of the following command creates the executable file a.out?

   A.) gcc -o sanfoundry.c
   B.) gcc sanfoundry.c
   C.) gcc -o a.out
   D.) gcc a.out

Answer: Option 'B'

gcc sanfoundry.c

DigitalOcean Referral Badge

2.

If we compile the sanfoudry.c file with the command “gcc -o sanfoundry sanfoundry.c”, then the executable file will be

   A.) a.out
   B.) sanfoundry
   C.) sanfoundry.out
   D.) none of these

Answer: Option 'B'

sanfoundry

DigitalOcean Referral Badge

3.

If we compile the sanfoundry.c file with the command “gcc -c sanfoundry.c”, then the output file will be

   A.) sanfoundry.o
   B.) sanfoundry.s
   C.) sanfoundry.i
   D.) none of these

Answer: Option 'A'

sanfoundry.o

DigitalOcean Referral Badge

4.

The command “gcc -S sanfoundry.c” will

   A.) stop compilation process after the generation of assembly code file
   B.) generate sanfoundry.s file
   C.) stop compilation process after the generation of assembly code file & generate sanfoundry.s file
   D.) none of these

Answer: Option 'C'

stop compilation process after the generation of assembly code file & generate sanfoundry.s file

DigitalOcean Referral Badge
    DigitalOcean Referral Badge DigitalOcean Referral Badge

5.

Which gcc option includes debugging info in the generated object code?

   A.) -g
   B.) -c
   C.) -p
   D.) none of these

Answer: Option 'A'

-g

DigitalOcean Referral Badge

6.

Which gcc option stops compilation process after preprocessing stage?

   A.) -e
   B.) -f
   C.) -E
   D.) -F

Answer: Option 'C'

-E

DigitalOcean Referral Badge

7.

The -v option of gcc

   A.) print the commands executed to run the stages of compilation
   B.) version of the gcc compiler
   C.) all of the mentioned
   D.) none of these

Answer: Option 'A'

print the commands executed to run the stages of compilation

DigitalOcean Referral Badge

8.

Which gcc option turns off certain features of gcc that are incompatible with ISO C89?

   A.) -ansi
   B.) -ISO
   C.) -ver
   D.) none of these

Answer: Option 'A'

-ansi
 

DigitalOcean Referral Badge

9.

The option -fsyntax-only of gcc

   A.) checks the code for syntax error
   B.) checks the code for fatal error
   C.) checks the code for syntax & fatal error
   D.) none of these

Answer: Option 'A'

checks the code for syntax error

DigitalOcean Referral Badge
    DigitalOcean Referral Badge DigitalOcean Referral Badge

10.

Which option of gcc inhibit all warning messages?

   A.) -w
   B.) -x
   C.) -y
   D.) -z

Answer: Option 'A'

-w

DigitalOcean Referral Badge

GCC Compiler Questions & Answers – Various Options -1 Download Pdf

Recent Posts