Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
This Finding the maximum and minimum in pseudocode worksheet is part of the IGCSE Computer Science 0478 — 7c Pseudocode and Flowcharts journey. Print it as a booklet?
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 | |
|---|---|---|
| 1Max ← Numbers[1] | AReplace the minimum whenever the current value is smaller than the smallest found so far | |
| 2IF Value < Min THEN Min ← Value | BStarting Max at 0 is wrong because if every value is negative, Max stays 0, which is not in the data. Start with the first element instead. | |
| 3To find the largest value, replace Max only when the current value is bigger than Max | CIF Value > Max THEN Max ← Value | |
| 4Start Max as the first element, then loop through the remaining elements from position 2 | DStart the maximum by storing the first value in the list, so Max begins as a real value from the data | |
| 5Max ← 0 | EFOR Index ← 2 TO 10 | |
| 6IF Value > Min THEN Min ← Value | FThe wrong operator is used. To find the minimum, the test must be Value < Min, so Min is replaced by smaller values. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
IF Value > Max THEN Max ← Value — Finds the largest value: set Max to the first value, loop through the rest, and replace Max whenever a larger value is found. The minimum works the same way using < instead.Max ← Scores[1]
FOR Index ← 2 TO 10IF Scores[Index] > Max THEN
Max ← Scores[Index]
ENDIFIF Value < Min THEN
Min ← Value
ENDIFIF Value < Min THEN
Min ← Value
ENDIFMax ← Scores[1]
FOR Index ← 2 TO 10
IF Scores[Index] > Max THEN