GCC Compiler Questions & Answers – Stages of Compilation – 1

This set of 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
View Answer

Answer: a
Explanation: 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
View Answer

Answer: a
Explanation: 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
View Answer

Answer: b
Explanation: None.

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

Answer: b
Explanation: None.
advertisement
advertisement

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
View Answer

Answer: d
Explanation: None.

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
View Answer

Answer: a
Explanation: None.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

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

Answer: b
Explanation: 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
View Answer

Answer: a
Explanation: None.
advertisement

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

Answer: a
Explanation: None.

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

Answer: b
Explanation: None.
advertisement

Sanfoundry Global Education & Learning Series – Linux Administration & Programming.

Here’s the list of Best Books in Linux Commands & Shell Programming.
Here’s the list of Best Books in Linux Kernel, Device-Drivers & System Programming.

To practice all questions on Linux Administration & Programming, here is complete set of 1000+ Multiple Choice Questions and Answers on Linux.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.