Past-paper question · 2016 May-June · Paper 42 · Q2(b)(i)

Question 2(b)(i) 2016 · May-June · Paper 42 · 4 marks

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

Official answer for Question 2

Part (b)

(i)

Part (b)

(i)

Question 4

✓
MyList
✓
Index
✓
Item

Question 1

Question 2

Question 3

Question 4

Question 5

Question 6

Question 7

Question 8

Question 9

Question 10

Question 1

Question 9

Question 3

Question 5

Question 8

Question 9

Question 13

Question 16

Question 27

✓
0
✓
0
✓
0

Question 2

Question 3

Question 13

Question 4

Question 16

Question 5

Question 27

Question 6

✓
0

Question 7

Question 8

✓
Note: Final mark only if no additional entries in table

Mark scheme 9608_s16_ms_42.pdf →

Show text version of question

Question 2

Part (b)

(i)

The recursive procedure X is defined as follows:

01 PROCEDURE X(Index, Item) 02 IF MyList[Index] > 0 03 THEN 04 IF MyList(Index) >= Item 05 THEN 06 MyList[Index] ← MyList[Index + 1] 07 ENDIF 08 CALL X(Index + 1, Item) 09 ENDIF 10 ENDPROCEDURE

An array MyList is used to store a sorted data set of non-zero integers. Unused cells contain zero.

1 2 3 4 5 6 7 8 9 10

MyList 3 5 8 9 13 16 27 0 0 0

Question 5

(i)

Complete the trace table for the dry-run of the pseudocode for the procedure

CALL X(1, 9).

MyList Index Item 1 2 3 4 5 6 7 8 9 10

[4]
Topic relevance

Why this question appears here

98% assigned-topic match · Computational thinking and problem-solving › Recursion

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

Keep practising this topic