A procedure RandList() will output a sequence of 25 random integers, where each integer is larger than the previous one.
- (a)Write pseudocode for procedure RandList().[6]
- (b)Procedure RandList() is modified so that the random numbers are also written into a 1D array Result. A new module is written to confirm that the numbers in the array are in ascending order. This module contains an IF statement that performs a comparison between elements: IF (Result[x + 1] = Result[x]) OR (Result[x] > Result[x + 1]) THEN Sequence ← FALSE ENDIF Write a simplified version of the conditional clause.[1]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2023). The mark or mark type is shown in brackets.
- 6 (a) MP1 Procedure heading and ending
- 6 (a) MP2 Local loop counter Count as integer
- 6 (a) MP3 Loop to iterate 25 times or more for each unique number
- 6 (a) MP4 'Attempt' to generate a random number including use of INT () in a loop
- 6 (a) MP5 Ensure that number generated is greater than previous and change 'previous'
- 6 (a) MP6 Output random number after an attempt at MP5 in a loop
- 1 (b) MP1 Result[x + 1] <= Result[x]
- 1 (b) ALTERNATIVE SOLUTION: Result [x] >= Result (x + 1]
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 →