GCC Compiler Questions & Answers – Various Options – 2

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

1. What is the job of -Werror option in gcc?
a) it avoids all the errors present in the source code
b) it makes all warnings into errors
c) it stores all the errors of source code into a seperate file
d) none of the mentioned
View Answer

Answer: b
Explanation: None.

2. The command “as -o sanfoundry.o sanfoundry.s” will
a) generate object file sanfoundry.o
b) provide an error if sanfoundry.s exists
c) generate object file sanfoundry.o & provide an error if sanfoundry.s exists
d) none of the mentioned
View Answer

Answer: a
Explanation: None.

3. The command “gcc -save-temps sanfoundry.c” will generate
a) sanfoundry.i
b) sanfoundry.s
c) sanfoundry.o
d) all of the mentioned
View Answer

Answer: d
Explanation: None.

4. The -H option of gcc
a) prints the name of each header file used
b) is used to include header file
c) ignores the header file which are not required by source code
d) none of the mentioned
View Answer

Answer: a
Explanation: None.
advertisement
advertisement

5. Which option of gcc enables compiler’s all warning messages?
a) -Wall
b) -War
c) -Warn
d) none of the mentioned
View Answer

Answer: a
Explanation: None.

6. Which option of gcc adds include directory of header files?
a) -i
b) -I
c) -e
d) -E
View Answer

Answer: b
Explanation: None.
Note: Join free Sanfoundry classes at Telegram or Youtube

7. The -fPIC option of gcc
a) generates the position independent code of shared libraries
b) opens the source file in readonly mode
c) opens the source file
d) none of the mentioned
View Answer

Answer: a
Explanation: None.

8. The -shared option of gcc generates shared ______ for shared library.
a) object file
b) preprocessed file
c) source file
d) none of the mentioned
View Answer

Answer: a
Explanation: None.
advertisement

9. Which option of gcc links with a library file?
a) -l
b) -L
c) -link
d) none of the mentioned
View Answer

Answer: a
Explanation: None.

10. Which option of gcc looks in the provided directory for library files?
a) -l
b) -L
c) -link
d) none of the mentioned
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.