Section B 2 (a) Write an algorithm in pseudocode to input 500 positive whole numbers. Each number input must be less than 1000. Find and output the largest number input, the smallest number input and the range (difference between the largest number and smallest number).
- (a)Write an algorithm in pseudocode to input 500 positive whole numbers. Each number input must be less than 1000. Find and output the largest number input, the smallest number input and the range (difference between the largest number and smallest number).[6]
- (b)Describe how the algorithm could be changed to make testing less time-consuming.[2]
Mark scheme
Marking points from the official mark scheme (May/June 2021). The mark or mark type is shown in brackets.
- [1] Initialisation of large and small variables e.g. Large ← 0 Small ← 1000
- [1] Use of a loop for 500 entries // or 499 if initialisation done on first correct entry
- [1] Input with prompt
- [1] Attempt at checking the range of 1 to 999 for input
- [1] ... working range check
- [1] Checking for a whole number
- [1] Selecting largest number
- [1] Selecting smallest number
- [1] Calculating the range
- [1] Outputting the largest, smallest and range with message
- [1] Reduce the amount of numbers entered
- [1] By decreasing the final value of the loop
- [1] Remove the need to input values
- [1] By using random numbers / a previously populated array
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →