250+ TOP MCQs on Stages of Compilation and Answers

Linux / Unix questions and answers focuses on various stages of compilation for gcc compiler. This is set 1.1. The correct sequence of GCC compilation process is
a) preprocessing -> compilation -> assemble -> linking
b) assemble -> preprocessing -> compilation -> linking
c) preprocessing -> assemble -> compilation -> linking
d) none of the mentioned

Answer: a
Clarification: None.

2. The preprocessor removes the _______ from the source code.
a) comments
b) header files
c) both comments and header files
d) none of the mentioned

Answer: a
Clarification: None.

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 the mentioned

Answer: b
Clarification: None.

4. The assembly code is converted into the machine code by
a) compiler
b) assembler
c) linker
d) none of the mentioned

Answer: b
Clarification: None.

5. 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 mentioned

Answer: d
Clarification: None.

6. If .c is compiled with GCC, then the .s file will contain the
a) assembly code
b) machine code
c) preprocessed code
d) expanded source code

Answer: a
Clarification: None.

7. The object file contains the
a) assembly code
b) machine code
c) modified source code
d) none of the mentioned

Answer: b
Clarification: None.

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: a
Clarification: None.

9. The macros specifies in source code are expanded by
a) preprocessor
b) assembler
c) compiler
d) linker

Answer: a
Clarification: None.

10. The preprocessor creates the file with extension
a) .a
b) .i
c) .s
d) .o

Answer: b
Clarification: None.

Leave a Reply

Your email address will not be published. Required fields are marked *