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 | |
|---|---|---|
| 1Smallest ← Marks[1] | AThe > operator is used instead of <, so this finds the largest value, not the smallest. Change it to Marks[Index] < Smallest. | |
| 2IF Marks[Index] < Smallest THEN Smallest ← Marks[Index] ENDIF | BStarts the minimum as the first mark in the array, so the first real value is the one to beat. | |
| 3To find the minimum, you must test whether the current item is LESS than Smallest, not greater. | CReplaces Smallest with the current mark only when that mark is lower than the smallest found so far. | |
| 4Start the minimum from an actual array value, so it works even if all the marks are above 0 or are negative. | DIF Marks[Index] < Smallest THEN | |
| 5Smallest ← 0 FOR Index ← 1 TO 10 IF Marks[Index] < Smallest THEN Smallest ← Marks[Index] ENDIF NEXT Index | ESmallest starts at 0, so if every mark is above 0 nothing is ever smaller and the output is wrongly 0. Start with Smallest ← Marks[1]. | |
| 6IF Marks[Index] > Smallest THEN Smallest ← Marks[Index] ENDIF | FSmallest ← Marks[1] |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
IF Marks[Index] < Smallest THEN Smallest ← Marks[Index] ENDIF — Inside a loop, this compares each item with Smallest and replaces Smallest when a lower value is found. Start Smallest as Marks[1], not 0, so the minimum is correct.Smallest ← Marks[1]IF Marks[Index] < Smallest THEN
Smallest ← Marks[Index]
ENDIFIF Marks[Index] < Smallest THEN
Smallest ← Marks[Index]
ENDIFSmallest ← Marks[1]
FOR Index ← 2 TO 10
IF Marks[Index] < Smallest THENIF Marks[Index] < Smallest THEN
Smallest ← Marks[Index]
ENDIF