Question 2(a) 2014 · October-November · Paper 22 · 8 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (a)
Part (a)
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
Question 7
Question 8
Question 64
Question 1
Question 15
Question 9
Question 1
Question 8
Question 52
Question 11
Question 12
Question 79
Question 2
Question 9
Question 10
Question 67
Question 3
Question 9
Question 64
Question 4
Show text version of question
Question 2
Part (a)
Question 2
Nathan copied the following pseudocode from a computing textbook. He wants to find out what it
does.
Part (a)
Dry-run the pseudocode with s = 64, x = 1 and y = 15.
Complete the trace table.
Start a new row in the trace table every time round the loop.
List z ← FALSE 1 27 REPEAT 2 28 m ← (x + y) DIV 2 3 33 IF List[m] = s THEN 4 36 z ← TRUE 5 39 ELSE 6 41 IF List[m] > s 7 45 THEN 8 52 y ← m – 1 9 64 ELSE 10 67 x ← m + 1 11 78 ENDIF 12 79 ENDIF 13 81 UNTIL z = TRUE 14 85 OUTPUT m 15 92
Trace table:
s z x y m List[m] List[m] = s List[m] > s
64 - 1 15 - - - -
FALSE - - - -
8 52
OUTPUT ...............................................................................................................................[8]
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 9691_w14_qp_22.pdf
