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 ← ___ FOR i ← 0 TO 4 Total ← Total + Marks[i] NEXT i | AThe blank must be the last index of the array, such as 4 for an array of 5 items | |
| 2FOR i ← 0 TO ___ OUTPUT Marks[i] NEXT i | BMax starts at 0, which fails if all values are negative. Max should start as the first array element, Marks[0]. | |
| 3A counting algorithm needs a closing keyword for its IF statement inside the loop, so the missing line is ENDIF | CFOR i ← 0 TO 9 IF Score[i] > 50 THEN Count ← Count + 1 ENDIF NEXT i | |
| 4A linear search with a WHILE loop must keep going only while the item is not found and the end of the list is not reached | DThe blank must be 0, so the total starts empty before any marks are added | |
| 5Max ← 0 FOR i ← 0 TO 4 IF Marks[i] > Max THEN Max ← Marks[i] ENDIF NEXT i | EWHILE Found = FALSE AND i <= 9 DO IF Names[i] = Target THEN Found ← TRUE ENDIF i ← i + 1 ENDWHILE | |
| 6REPEAT INPUT Num Total ← Total + Num ENDWHILE | FThe wrong closing keyword is used. A REPEAT loop must end with UNTIL and a condition, not ENDWHILE. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
complete the algorithm — Fill each missing line or value by asking what the standard method (total, count, max, search, sort) needs at that point: start value, loop bound, condition or closing keyword.Total ← 0
FOR Index ← 1 TO 5
Total ← Total + Num[Index]DECLARE Mark : ARRAY[1:10] OF INTEGER
FOR Index ← 1 TO 10
Total ← Total + Mark[Index]IF Mark[Index] > Max THEN
Max ← Mark[Index]
ENDIFFOR Index ← 1 TO 10
Total ← Total + Mark[Index]
NEXT IndexREPEAT
INPUT Guess
UNTIL Guess = 42