Computer Science · Oct / Nov 2020 · Paper 22 · Question 5
0478
As printed in the paper
The question as text
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
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
5(a)[5]
Num
Num
Num
Num
Num
Flag
Count
Store [0]
[1]
[2]
[3]
[4]
45
56
30
12
15
0
0
45 56
1
45
1
2
3
12 15
12
0
0
1
2
3
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
5(b)[2]
Any two from:
The algorithm sorts/orders numbers… into descending order / from largest to smallest
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

