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 | |
|---|---|---|
| 1Traceback (most recent call last): File "main.py", line 5 ZeroDivisionError: division by zero | Aassert average([10, 20, 30]) == 20 | |
| 2Expected: 15, Actual: 5 | BThe fix was not understood or tested, but AI suggestions can be wrong and must always be checked | |
| 3After an AI suggests a fix, you verify it by running the program again with test data and checking the output | CA description of expected vs actual output that helps an AI find a logic error where there is no error message | |
| 4A good debugging prompt includes the code, the error message and the expected behaviour | Dprompt = code + traceback + "Expected: total of 15" | |
| 5Prompt: "My code doesn't work. Fix it." | EThe error message you paste into an AI tool so it can see the error type and the line where the program failed | |
| 6Paste the AI's fixed code into the project and submit it without running it | FThe prompt gives no code, no error message and no expected behaviour, so the AI can only guess at the cause |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
AI debugging — Giving an AI tool your code, the error message and the expected behaviour so it suggests a cause and a fix, which you must still understand and test yourself.def add(a, b):
return a + b
assert add(2, 3) == 5try:
result = 10 / 0
except ZeroDivisionError:for price in prices:
total = total + priceexpected = 5
actual = average([4, 6])
print(expected == actual)def average(nums):
return sum(nums) / len(nums)