Past-paper question · 2021 May-June · Paper 42 · Q5

Question 5 2021 · May-June · Paper 42 · 5 marks

Original past-paper question for 5
Reveal official mark-scheme answer Official mark-scheme answer for 5

Official answer for Question 5

Question 1

mark for each completed statement (in bold)

Question 5

✓
PROCEDURE
✓
InsertionSort()
✓
DECLARE
✓
Count : INTEGER
✓
DECLARE
✓
Counter : INTEGER
✓
DECLARE
✓
Temp : INTEGER
✓
Count ← 1
✓
WHILE Count < 10
✓
Temp = TheArray[Count]
✓
Counter = Count - 1
✓
WHILE Counter >= 0 AND TheArray[Counter] > Temp
✓
TheArray[Counter + 1] ← TheArray[Counter]
✓
Counter ← Counter - 1
✓
ENDWHILE
✓
TheArray[Counter + 1] ← Temp
✓
Count ← Count + 1
✓
ENDWHILE
✓
ENDPROCEDURE
✓
9608/42
✓
Cambridge International AS & A Level – Mark Scheme
✓
May/June 2021
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_s21_ms_42.pdf →

Show text version of question

Question 5

The following procedure performs an insertion sort on the global array TheArray that has 10 elements.

Complete the pseudocode for the procedure InsertionSort().

PROCEDURE InsertionSort()

DECLARE Count : INTEGER

DECLARE Counter : INTEGER

DECLARE Temp : INTEGER

Count ..............................................

WHILE Count < 10

Temp TheArray[Count]

Counter Count .................................................

WHILE ........................... >= 0 AND TheArray[Counter] > ...................................

TheArray[Counter + 1] TheArray[Counter]

Counter Counter - 1

ENDWHILE

TheArray[..............................................] Temp

Count Count + 1

ENDWHILE

ENDPROCEDURE

[5]

Question 16

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

Keep practising this topic