Past-paper question · 2018 May-June · Paper 42 · Q3(b)

Question 3(b) 2018 · May-June · Paper 42 · 7 marks

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

Official answer for Question 3

Part (b)

Question 1

mark for each correct statement

Question 7

✓
01 ArraySize ← 10
✓
02 FOR Pointer ← 2 TO ArraySize // 10
✓
ValueToInsert ← CardData[Pointer]
✓
03
✓
HolePosition ← Pointer
✓
04
✓
05
✓
WHILE(HolePosition>1 AND(CardData[HolePosition - 1] > ValueToInsert))
✓
CardData[HolePosition] ← CardData[ HolePosition – 1 ]
✓
06
✓
HolePosition ← HolePosition – 1
✓
07
✓
08
✓
ENDWHILE
✓
CardData[HolePosition] ← ValueToInsert
✓
09
✓
10 ENDFOR

Mark scheme 9608_s18_ms_42.pdf →

Show text version of question

Question 3

Part (b)

Question 3

The arrays PollData[1:10] and CardData[1:10] store data.

PollData 12 85 52 57 25 11 33 59 56 91

CardData 11 12 25 33 52 56 57 59 91 85

An insertion sort sorts these data.

Part (b)

The following pseudocode algorithm performs an insertion sort on the CardData array.

Complete the following pseudocode algorithm.

01 ArraySize ← 10

02 FOR Pointer ← 2 TO .........................................................................................................

03 ValueToInsert ← CardData[Pointer]

04 HolePosition ← .............................................................................................................

05 WHILE (HolePosition > 1 AND (.............................................. > ......................... ))

06 CardData[HolePosition] ← CardData[ ..............................................................]

07 HolePosition ← .........................................................................................................

08 ENDWHILE

09 CardData[HolePosition] ← ........................................................................................

10 ENDFOR

[7]

Question 9

Topic relevance

Why this question appears here

76% assigned-topic match · Data types and structures › Arrays

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_s18_qp_42.pdf

Keep practising this topic