Question 5(b)(i) 2015 · May-June · Paper 42 · 2 marks
Reveal official mark-scheme answer

Official answer for Question 5
Part (b)
(i)
Part (b)
(i)
outer loop is executed 9 times
Question 42
Show text version of question
Question 5
Part (b)
(i)
Question 5
Data is stored in the array NameList[1:10]. This data is to be sorted.
An alternative sort algorithm is a bubble sort:
FOR ThisPointer ← 1 TO 9 FOR Pointer ← 1 TO 9 IF NameList[Pointer] > NameList[Pointer + 1] THEN Temp ← NameList[Pointer] NameList[Pointer] ← NameList[Pointer + 1] NameList[Pointer + 1] ← Temp ENDIF ENDFOR ENDFOR
(i)
As in part (a)(ii), a special case is when NameList is already in order. The algorithm in
part
Part (b)
is applied to this special case.
Explain how many iterations are carried out for each of the loops.
...........................................................................................................................................
...........................................................................................................................................
...........................................................................................................................................
......................................................................................................................................
Question 12
Why this question appears here
71% assigned-topic match · Programming › Constructs
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9608_s15_qp_42.pdf
