Past-paper question · 2019 October-November · Paper 23 · Q5(b)

Question 5(b) 2019 · October-November · Paper 23 · 100 marks

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

Official answer for Question 5

Part (b)

✓
Two from:

Question 2

  • Search for the value input «
  • « using an array«
  • « of sorted data
✓
Question
✓
Answer
✓
Marks

Mark scheme 2210_w19_ms_23.pdf →

Show text version of question

Question 5

Part (b)

Question 5

The algorithm performs an operation on the array named MyData

DIV means integer division, so only the whole number part of the result is returned e.g. 7 DIV 2 returns a value of 3

First 0 Last 16 Found FALSE INPUT UserIn WHILE (First <= Last) AND (Found = FALSE) DO Middle (First + Last) DIV 2 IF MyData[Middle] = UserIn THEN Found TRUE ELSE IF UserIn < MyData[Middle] THEN Last Middle - 1 ELSE First Middle + 1 ENDIF ENDIF ENDWHILE OUTPUT Found

This table shows the contents of the array: MyData e.g. MyData[2] stores the value 5

MyData Index [0]

[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]

Value 2 3 5 6 8 10 12 13 14 16 18 20 25 27 29 34 36

Part (b)

Describe the function being performed by the algorithm.

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

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

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

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

[2]

Question 11

Topic relevance

Why this question appears here

99% assigned-topic match · Programming › Programming concepts

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 2210_w19_qp_23.pdf

Keep practising this topic