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 | |
|---|---|---|
| 1Count ← 0 | ACount ← Count + 1 is outside the IF, so it counts every pass instead of only the items that meet the condition. | |
| 2Count ← Count + 1 | BCount ← 0 is inside the loop, so the counter is reset to zero on every pass and the total is lost. | |
| 3To count only the marks that are 50 or more, put the counting statement inside an IF within the loop | CAdds 1 to the counter each time it runs, so it counts one more matching item | |
| 4To count how many times the loop passes (every item, not just matches), add 1 in the loop with no IF | DIF Mark >= 50 THEN Count ← Count + 1 ENDIF | |
| 5FOR Index ← 1 TO 10 Count ← 0 IF Mark[Index] > 50 THEN Count ← Count + 1 ENDIF NEXT Index | EFOR Index ← 1 TO 10 Passes ← Passes + 1 NEXT Index | |
| 6Count ← 0 FOR Index ← 1 TO 10 Count ← Count + 1 IF Mark[Index] > 50 THEN OUTPUT Mark[Index] ENDIF NEXT Index | FSets the counter to zero before the loop starts, so the count begins from nothing |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Count ← Count + 1 — Adds 1 to Count each time an item meets a condition. Put it inside an IF in the loop, and set Count ← 0 before the loop starts so the count begins at zero.Count ← 0
FOR Index ← 1 TO 10
INPUT MarkFOR Index ← 1 TO 10
IF Mark >= 50 THEN
Count ← Count + 1IF Mark >= 50 THEN
Count ← Count + 1
ENDIFIF Age >= 18 THEN
Count ← Count + 1
ENDIFIF Score > 80 THEN
Count ← Count + 1
ENDIF