Past-paper question · 2018 October-November · Paper 42 · Q3(a)

Question 3(a) 2018 · October-November · Paper 42 · 7 marks

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

Official answer for Question 3

Part (a)

Question 1

mark for each completed statement:

Question 7

✓
01 FOR Outer ← LENGTH(List)-1 TO 0 STEP -1
✓
FOR Inner ← 0 TO (Outer – 1)
✓
02
✓
03
✓
IF List[Inner] > List[Inner + 1]
✓
04
✓
THEN
✓
Temp ← List[Inner]
✓
05
✓
List[Inner] ← List[Inner + 1]
✓
06
✓
List[Inner + 1] ← Temp
✓
07
✓
08
✓
ENDIF
✓
09
✓
ENDFOR
✓
10 ENDFOR

Mark scheme 9608_w18_ms_42.pdf →

Show text version of question

Question 3

Part (a)

Question 3

A bubble sort algorithm is used to sort an integer array, List. This algorithm can process arrays

of different lengths.

Part (a)

Write pseudocode to complete the bubble sort algorithm shown.

01 FOR Outer ..................................................................................... TO 0 STEP - 1

02 FOR Inner 0 TO (.........................................................................................)

03 IF .............................................................. > ....................................................

04 THEN

05 Temp ..................................................................

06 List[Inner] ....................................................................

07 List[Inner + 1] .........................................................................

08 ENDIF

09 ENDFOR

10 ENDFOR

[7]
Topic relevance

Why this question appears here

82% assigned-topic match · Algorithm design and problem-solving › Algorithms

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

Keep practising this topic