This pseudocode represents an algorithm. REPEAT Flag ← 0 FOR Count ← 0 to 3 IF Num [Count] < Num [Count + 1] THEN Store ← Num [Count] Num [Count] ← Num [Count + 1] Num [Count + 1] ← Store Flag ← 1 ENDIF NEXT Count UNTIL Flag = 0
- (a)The contents of the array at the start of the algorithm are: Num [0] | Num [1] | Num [2] | Num [3] | Num [4] --- | --- | --- | --- | --- 45 | 56 | 30 | 12 | 15 Complete the trace table for the algorithm using the data given in the array. Flag | Count | Num [0] | Num [1] | Num [2] | Num [3] | Num [4] | Store --- | --- | --- | --- | --- | --- | --- | --- | | 45 | 56 | 30 | 12 | 15 |[5]
- (b)Describe the purpose of the algorithm.[2]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2020). The mark or mark type is shown in brackets.
- [5] One mark - Flag column
- One mark - Count column
- One mark - Num [0] and Num [1] columns
- One mark - Num [2], Num [3] and Num [4] columns
- One mark – Store column
- [2] Any two from: The algorithm sorts/orders numbers
- ... into descending order / from largest to smallest
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 →