CS 2204 Quiz – Week of 10/29/2001

 


1.      What option must be specified to gcc in order to be able to debug a given executable?

a.  –d

b.  –debug

c.  –sym

d.  –g

Answer: d

 

2.      The next command in gdb allows you to:

a.       list the next five lines in the program

b.      execute the next statement in the program

c.       execute the next statement in the program, stepping into any functions called there

d.      skip the next line of the program

Answer: b

 

3.      What is the purpose of a conditional breakpoint in gdb?

a.       to terminate program execution when a certain condition becomes true

b.      to stop the program when a certain function is reached

c.       to stop the program at some statement only if a certain condition is true

d.      to break the computer keyboard if and only if you can’t find the bug in your program

Answer: c

 

4.      Which gdb command allows you to show the value of a variable continuously (show the value after each statement is executed)?

a.  display

b.  print

c.  show

d.  permanent

Answer: a

 

5.      Which of these is not an advantage of using gdb as opposed to using print statements in your code?

a.       when using print statements you must guess as to the nature of the problem

b.      print statements can’t be used to show you the contents of an array

c.       gdb allows you to stop execution at any point to examine the state of the program

d.      it’s difficult to debug pointer problems with print statements

Answer: b