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 | |
|---|---|---|
| 1Click beside line 12 | ABreakpoint on line 8 with condition: i == 50 | |
| 2Click the red dot on line 12 | BA comment is not executed, so the program can never pause there. The breakpoint must go on a line of real code. | |
| 3Place a breakpoint on the line just before a suspected bug so you can inspect variables before the fault happens | CBreakpoints only pause the program when it is run in debug mode. A normal run ignores them, so the program never stops. | |
| 4A conditional breakpoint only pauses the program when a condition is true | Dtotal = total + price # breakpoint here, before the wrong total is printed | |
| 5Run the program normally, then expect it to pause at the breakpoint on line 5 | ESets a breakpoint on line 12 so the program will pause there | |
| 6Set the breakpoint on a comment line: # check the total | FRemoves the breakpoint from line 12 |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
breakpoint — A marker set on a line of code (click beside the line number) that pauses the program there in debug mode, so you can inspect variables and step through the code.total = 0
breakpoint()
print(total)if score > 100:
breakpoint()if count == 0:
breakpoint()
average = total / countfor mark in marks:
total += mark
breakpoint()for i in range(10):
if i == 7:
breakpoint()