GCC Compiler Questions & Answers – Various Options – 3

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

1. The command “cpp sanfoundry.c > sanfoundry.i” will
a) create the expanded source code file sanfoudry.i for the source code file sanfoundry.c
b) append the content of the sanfoundry.c into sanfoundry.i
c) give an error
d) none of the mentioned
View Answer

Answer: a
Explanation: None.

2. Which option of gcc makes the compiler print out each function name as it is compiled, and print some statistics about each pass when it finishes?
a) -p
b) -P
c) -q
d) -Q
View Answer

Answer: d
Explanation: None.

3. The -Wextra option of gcc
a) is same as -w option
b) does not exist
c) enables extra warning messages
d) none of the mentioned
View Answer

Answer: c
Explanation: None.

4. Which gcc option undefines a preprocessor macro?
a) -U
b) -u
c) -undefine
d) none of the mentioned
View Answer

Answer: a
Explanation: None.
advertisement
advertisement

5. Pipes are used rather than temporary files for communication between the various stages of compilation in gcc when
a) -pipe option is used
b) -temp option is used
c) –disable -temp option is used
d) none of the mentioned
View Answer

Answer: a
Explanation: None.

6. The gcc option -Wunused warns when a _____ variable is unused aside from its declaration.
a) variable
b) function
c) macro
d) none of the mentioned
View Answer

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

7. Which one of the following is not true?
a) source codes can not be compiled with static libraries in gcc
b) -O is used for optimization in gcc
c) source codes can be compiled
d) none of the mentioned
View Answer

Answer: a
Explanation: None.

8. The command line options of gcc can also be read from a file with
a) @
b) $
c) #
d) none of the mentioned
View Answer

Answer: c
Explanation: None.
advertisement

9. Which option of the gcc is used to warn is padding is included in structure?
a) -Wpadded
b) -Wpad
c) -Wpadding
d) None of the mentioned
View Answer

Answer: a
Explanation: None.

10. Which gcc option reports the cpu time taken by each subprocess in the compilation sequence?
a) -time
b) -cpu
c) -process
d) none of the mentioned
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.