GDB Debugger Questions & Answers – 1

This set of Linux / Unix questions and answers focuses on GDB. This is set 1.

1. For debugging with GDB, the file “sanfoundry” can be created with the command
a) gcc -g -o sanfoundry sanfoundry.c
b) gcc -g sanfoundry.c
c) gdb sanfoundry
d) none of the mentioned
View Answer

Answer: a
Explanation: None.

2. For debugging with GDB, the compiled program can be run by the command
a) run
b) execute
c) ./<filename>
d) none of the mentioned
View Answer

Answer: a
Explanation: None.

3. In GDB, breakpoints can be set by the command
a) break
b) b
c) both break and b
d) none of the mentioned
View Answer

Answer: c
Explanation: None.

4. GDB stands for
a) GNU debugger
b) General debugging breakpoint
c) General debugger
d) None of the mentioned
View Answer

Answer: a
Explanation: None.
advertisement
advertisement

5. GDB can be used for
a) c language
b) c++ language
c) both c and c++ language
d) none of the mentioned
View Answer

Answer: c
Explanation: None.

6. The command “gdb sanfoundy”
a) will start debugging for the file “sanfoundry” if the file is compiled with -g option with GCC
b) will create executable for debugging
c) will provide all errors present in the file “sanfoundry”
d) none of the mentioned
View Answer

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

7. In debugging with GDB, break points can be set to
a) any line
b) any function
c) both any line and function
d) none of the mentioned
View Answer

Answer: c
Explanation: None.

8. In GDB debugging, we can proceed to the next breakpoint with command
a) next
b) continue
c) both next and continue
d) none of the mentioned
View Answer

Answer: b
Explanation: None.
advertisement

9. At the time of debugging with GDB, if we just press ENTER
a) GDB will repeat the same command you just gave it
b) GDB will do nothing
c) GDB will exit
d) None of the mentioned
View Answer

Answer: a
Explanation: None.

10. To print the value of a variable while debugging with GDB, ______ command can be used.
a) printf
b) print
c) show
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.