GCC Compiler Questions & Answers – Various Options -1

This set of Linux / Unix questions and answers focuses on various options used in compilation with gcc. This is set 1.

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

Answer: b
Explanation: None.

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

Answer: b
Explanation: None.

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

Answer: a
Explanation: None.

4. Which gcc option includes debugging info in the generated object code?
a) -g
b) -c
c) -p
d) none of the mentioned
View Answer

Answer: a
Explanation: None.
advertisement
advertisement

5. 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 the mentioned
View Answer

Answer: c
Explanation: None.

6. Which gcc option stops compilation process after preprocessing stage?
a) -e
b) -f
c) -E
d) -F
View Answer

Answer: c
Explanation: None.

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

Answer: a
Explanation: None.

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

Answer: a
Explanation: None.
advertisement

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

Answer: a
Explanation: None.

10. Which option of gcc inhibit all warning messages?
a) -w
b) -x
c) -y
d) -z
View Answer

Answer: a
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.