A ticket-price program produces an incorrect total for a repeatable test input. You have recorded the expected total, confirmed the source file and interpreter, and set a breakpoint immediately before the suspected assignment. Arrange the remaining actions to inspect the values before and after that assignment, then verify a source-code correction.
1.
Restart the saved program with the same input and compare its output with the expected total.
2.
Stop execution, correct the identified source error, and save the corrected file.
3.
Inspect and record the current values that the suspected assignment will use.
4.
Step Over the assignment once and compare its resulting value with the expected calculation.
5.
Start debugging with the recorded input and pause at the breakpoint before the suspected assignment.
Unlock full course notes by signing up
Track two debugger steps
A Python debugger is paused immediately before the first statement below. Its variable inspector shows price = 6, quantity = 9, and discount = 7. Price and discount are in dollars; quantity is an item count.
In this debugger, Step Over executes the highlighted statement and pauses before the next one. After pressing Step Over exactly twice, what value will the inspector show for total? Answer in dollars, to zero decimal places. The initially highlighted statement has not yet executed.
Predict the pauses at a loop breakpoint
A student runs the program below in their IDE's debug mode. The only breakpoint is on the line total = total + i, and each time the program pauses the student reads the Variables pane, then presses Resume (Continue) to run on to the next breakpoint hit.
Complete the table with whole numbers: the values of i and total shown in the Variables pane at each pause, and their values when the print line runs after the loop.
Separate environment evidence from program evidence
An IDE can select either Python interpreter A or Python interpreter B. A helper library is installed for A, but it is unavailable to B. The Run configuration currently selects B and the intended saved source file. The program first imports the helper library, then calculates a bill. A breakpoint is set before the calculation.
The current run stops at the import with a library-not-found error, before reaching the breakpoint. The Shell also contains a successful bill from yesterday's run using A and different input. Which statements are supported by the evidence from the current run? Select all that apply.
Trace a breakpoint inside a called function
A student debugs the program below. The only breakpoint is on the line bonus = n // 10 inside score. They start the debugger and press Resume (Continue) after every pause until the program finishes.
Give each answer as a whole number:
how many times the program pauses on the breakpoint line;