Past-paper question · 2019 May-June · Paper 42 · Q4(b)(ii)

Question 4(b)(ii) 2019 · May-June · Paper 42 · 3 marks

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

Official answer for Question 4

Part (b)

(ii)

Question 1

mark per bullet point

Question 3

✓
•
✓
Initialising a counter variable to 0 and must be the same variable used to access array elements
✓
•
✓
While loop checking counter is < 5 or <= 4
✓
•
✓
Incrementing counter inside the loop and outside IF, and remainder of algorithm completed (The IF to ENDIF)
✓
e.g.
✓
Count ← 0
✓
WHILE Count < 5
✓
IF ArrayData[Count] > ArrayData[Count + 1]
✓
THEN
✓
TempValue ← ArrayData[Count + 1]
✓
ArrayData[Count + 1] ← ArrayData[Count]
✓
ArrayData[Count] ← TempValue
✓
Sorted ← False
✓
ENDIF
✓
Count ← Count + 1
✓
ENDWHILE

Mark scheme 9608_s19_ms_42.pdf →

Show text version of question

Question 4

Part (b)

(ii)

The following is an example of a sorting algorithm. It sorts the data in the array ArrayData.

01 TempValue "" 02 REPEAT 03 Sorted TRUE 04 FOR Count 0 TO 4 05 IF ArrayData[Count] > ArrayData[Count + 1] 06 THEN 07 TempValue ArrayData[Count + 1] 08 ArrayData[Count + 1] ArrayData[Count] 09 ArrayData[Count] TempValue 10 Sorted FALSE 11 ENDIF 12 ENDFOR 13 UNTIL Sorted = TRUE

(ii)

Rewrite lines 4 to 12 of the algorithm in part

Part (b)

using a WHILE loop instead of a FOR

loop.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[3]
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_s19_qp_42.pdf

Keep practising this topic