GCC Compiler Questions & Answers – Stages of Compilation – 1

DigitalOcean Referral Badge DigitalOcean Referral Badge

1.

The correct sequence of GCC compilation process is

   A.) preprocessing -> compilation -> assemble -> linking
   B.) preprocessing -> compilation -> assemble -> linking
   C.) assemble -> preprocessing -> compilation -> linking
   D.) preprocessing -> assemble -> compilation -> linking

Answer: Option 'A'

preprocessing -> compilation -> assemble -> linking

DigitalOcean Referral Badge

2.

The preprocessor removes the _______ from the source code.

   A.) comments
   B.) header files
   C.) both comments and header files
   D.) none of these

Answer: Option 'A'

comments

DigitalOcean Referral Badge

3.

The compiler converts

   A.) assembly code into machine code
   B.) preprocessed source code into assembly code
   C.) machine code into assembly code
   D.) none of these

Answer: Option 'B'

preprocessed source code into assembly code

DigitalOcean Referral Badge

4.

What is the role of linker in the compilation process?

   A.) linker links the object code with the library code
   B.) linker converts machine code into executable machine code
   C.) linker generates an executable file
   D.) all of the these

Answer: Option 'D'

all of the these
 

DigitalOcean Referral Badge
    DigitalOcean Referral Badge DigitalOcean Referral Badge

5.

The assembly code is converted into the machine code by

   A.) compiler
   B.) assembler
   C.) linker
   D.) none of these

Answer: Option 'B'

assembler

DigitalOcean Referral Badge

6.

If sanfoundry.c is compiled with GCC, then the sanfoundry.s file will contain the

   A.) assembly code
   B.) machine code
   C.) preprocessed code
   D.) expanded source code

Answer: Option 'A'

assembly code

DigitalOcean Referral Badge

7.

The object file contains the

   A.) assembly code
   B.) machine code
   C.) modified source code
   D.) none of these

Answer: Option 'B'

machine code

DigitalOcean Referral Badge

8.

If we do not specify the executable file name at the compilation time in GCC, then in linux the compiler creates executable named as

   A.) a.out
   B.) a.exe
   C.) x.out
   D.) x.exe

Answer: Option 'A'

a.out

DigitalOcean Referral Badge

9.

The macros specifies in source code are expanded by

   A.) preprocessor
   B.) assembler
   C.) compiler
   D.) linker

Answer: Option 'A'

preprocessor

DigitalOcean Referral Badge
    DigitalOcean Referral Badge DigitalOcean Referral Badge

10.

The preprocessor creates the file with extension

   A.) .a
   B.) .i
   C.) .s
   D.) .o

Answer: Option 'B'

.i

DigitalOcean Referral Badge

GCC Compiler Questions & Answers – Stages of Compilation – 1 Download Pdf

Recent Posts