GDB Debugger Questions & Answers – 2

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

1. Which GDB command prints the value of a variable in hex.
a) print/x
b) print/h
c) print/e
d) none of the mentioned
View Answer

Answer: a
Explanation: None.

2. Which GDB command interrupts the program whenever the value of a variable is modified and prints the value old and new values of the variable?
a) watch
b) show
c) trace
d) none of the mentioned
View Answer

Answer: a
Explanation: None.

3. Which GDB command produces a stack trace of the function calls that lead to a segmentation fault?
a) trace
b) backtrace
c) forwardtrace
d) none of the mentioned
View Answer

Answer: b
Explanation: None.

4. The specific break point can be deleted by _____ command in GDB.
a) delete
b) del
c) remove
d) none of the mentioned
View Answer

Answer: a
Explanation: None.
advertisement
advertisement

5. The “step” command of GDB
a) executes the current line of the program
b) stops the next statement to be executed
c) executes the current line of the program & stops the next statement to be executed
d) none of the mentioned
View Answer

Answer: c
Explanation: None.

6. Which GDB command reloads the debugging information?
a) file
b) reload
c) debug
d) none of the mentioned
View Answer

Answer: a
Explanation: None.

7. GDB can be used
a) to find out the memory leakages
b) to get the result of a particular expression in a program
c) to find the reason of segementation fault
d) all of the mentioned
View Answer

Answer: d
Explanation: None.

8. Which GDB command can be used to put a breakpoint at the beginning of the program?
a) b main
b) b start
c) break
d) none of the mentioned
View Answer

Answer: a
Explanation: None.
advertisement

9. To put the breakpoint at the current line ____ command can be used?
a) b
b) break
c) both b and break
d) none of the mentioned
View Answer

Answer: c
Explanation: None.

10. We can list all the breakpoint in GDB by the command
a) info break
b) break all
c) both info break and break all
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.