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 | |
|---|---|---|
| 1Total = Total + Mark | AA logic error: Total starts with no value, so the final total will be wrong. Set Total ← 0 before the loop. | |
| 2Expected 15, actual output 10 | BA presentation error: = is used for assignment instead of ←, so the pseudocode rules are broken | |
| 3A logic error gives wrong results, such as a loop that stops one step too early | CFOR Count ← 1 TO 4 // should repeat 5 times | |
| 4A presentation error breaks the pseudocode rules, such as a missing keyword to close a structure | DIF Score > 50 THEN OUTPUT "Pass" | |
| 5Total ← Total + Mark (Total never set to 0 first) | EA logic error: Count never changes, so the loop never ends. Add Count ← Count + 1 inside the loop. | |
| 6WHILE Count <= 5 DO OUTPUT Count ENDWHILE | FA sign of a logic error: the actual output does not match the expected output for the test values |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
error in an algorithm — A mistake that breaks pseudocode rules or gives wrong results. Find it by reading the code, then trace it with test values and compare the actual output with the expected output.IF Mark >= 50 THEN
OUTPUT "Pass"
ENDIF// Test value 50 should output Pass
IF Mark >= 50 THEN
OUTPUT "Pass"Total ← 0
INPUT Num
Total ← Total + Num// Expected output: 1 2 3 4 5
FOR Count ← 1 TO 5
OUTPUT CountIF Actual <> Expected THEN
OUTPUT "Error found"
ENDIF