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 + Marks[i] | ATotal is reset to 0 inside the loop, so it is wiped every time. The standard method sets it to 0 once before the loop. | |
| 2IF Marks[i] > Max THEN Max ← Marks[i] | BIF Nums[i] > Nums[i + 1] THEN Temp ← Nums[i] | |
| 3Linear search is a standard method that checks each item in turn until the target is found | CIF Names[i] = Target THEN Found ← TRUE | |
| 4Bubble sort is a standard method that swaps neighbouring items that are in the wrong order | DCounting should add 1 each time, not add the value. This adds the mark itself, so it totals instead of counting. | |
| 5Count ← Count + Marks[i] | ETotalling: adds each array value to a running total inside a loop | |
| 6FOR i ← 1 TO 10 Total ← 0 Total ← Total + Marks[i] NEXT i | FFinding the maximum: keeps the largest value seen so far |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
standard method — A tried-and-tested algorithm for a common task, such as totalling, counting, max/min, average, linear search or bubble sort, that programmers reuse instead of inventing a new solution.Total ← 0
FOR i ← 1 TO 10
Total ← Total + Mark[i]FOR i ← 1 TO 10
IF Mark[i] > 50 THEN Count ← Count + 1
NEXT iMax ← Mark[1]
IF Mark[i] > Max THEN
Max ← Mark[i]Found ← FALSE
FOR i ← 1 TO 10
IF Name[i] = Target THEN Found ← TRUETemp ← Num[j]
Num[j] ← Num[j + 1]
Num[j + 1] ← Temp