Computer Science · May / June 2021 · Paper 22 · Question 2
0478
As printed in the paper
Show the answer and mark scheme
2(a)[6]
Any six from:
MP1
Initialisation of large and small variables e.g. Large ← 0 Small ← 1000
MP2
Use of a loop for 500 entries // or 499 if initialisation done on first correct entry
MP3
Input with prompt
MP4
Attempt at checking the range of 1 to 999 for input
MP5
… working range check
MP6
Checking for a whole number
MP7
Selecting largest number
MP8
Selecting smallest number
MP9
Calculating the range
MP10 Outputting the largest, smallest and range with message
Large ← 0
Small ← 1000
FOR Count ← 1 TO 500
REPEAT
OUTPUT "Enter a whole number between 1 and 999"
INPUT Number
UNTIL Number >= 1 AND Number < 1000 AND Number = Number DIV 1
IF Number < Small
THEN
Small ← Number
ENDIF
IF Number > Large
THEN
Large ← Number
ENDIF
NEXT
Range ← Large – Small
OUTPUT "Largest number is ", Large, " Smallest number is ", Small, " Range of numbers is ", Range
2(b)[2]
One mark for action required and one mark for method used
Reduce the amount of numbers entered
By decreasing the final value of the loop
or
Remove the need to input values
By using random numbers / a previously populated array
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

