Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1Step Over | AContinue (F5) | |
| 2Step Into | BMoves into the function being called on the current line and pauses on that function's first line. | |
| 3A watch window shows the current value of a variable at each pause, so you can see when it changes. | CStep into on a built-in function like print() goes into library code you don't need. Use step over, then check total in the watch panel. | |
| 4Continue runs the program from a pause until it reaches the next breakpoint, skipping the lines in between. | DRuns the current line in full, including any function it calls, then pauses on the next line in the same function. | |
| 5Step Into on print(total) to check why total is wrong | EWatch: total = 45 | |
| 6Stepping through 500 loop passes with Step Over, one line at a time, to reach the last pass | FStepping line by line through every pass is slow. Set a breakpoint after the loop and use Continue, or watch the variable to find the line where its value goes wrong. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
step through — Run paused code one line at a time using step over, step into or step out, while the watch panel shows each variable change, to find where a value goes wrong.total = 0
breakpoint()
total = total + 5total = total + 5
(Pdb) nexttotal = add(2, 3)
(Pdb) step(Pdb) display total(Pdb) continue