Past-paper question · 2015 May-June · Paper 42 · Q5(b)(i)

Question 5(b)(i) 2015 · May-June · Paper 42 · 2 marks

Original past-paper question for 5(B)(I)
Original past-paper question for 5(B)(I)
Original past-paper question for 5(B)(I)
Reveal official mark-scheme answer Official mark-scheme answer for 5(B)(I)Official mark-scheme answer for 5(B)(I)

Official answer for Question 5

Part (b)

(i)

Part (b)

(i)

outer loop is executed 9 times

✓
(1 mark)
✓
inner loop is executed 9 times (for each iteration of the outer loop)
✓
(1 mark)
✓
(1 mark)
✓
[max 2]
✓
Mark Scheme
✓
Syllabus
✓
Paper
✓
Cambridge International A Level – May/June 2015
✓
9608

Question 42

Mark scheme 9608_s15_ms_42.pdf →

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.

...........................................................................................................................................

...........................................................................................................................................

...........................................................................................................................................

......................................................................................................................................

[2]

Question 12

Topic relevance

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

Keep practising this topic