Past-paper question · 2015 May-June · Paper 43 · Q6(c)

Question 6(c) 2015 · May-June · Paper 43 · 6 marks

Original past-paper question for 6(C)
Original past-paper question for 6(C)
Reveal official mark-scheme answer Official mark-scheme answer for 6(C)

Official answer for Question 6

Part (c)

Part (c)

✓
Call number
✓
n
✓
(n=0) OR (n=1)
✓
n DIV 2
✓
n MOD 2
✓
0

Question 1

Question 40

✓
FALSE

Question 20

Question 10

✓
0

Question 2

Question 20

✓
FALSE

Question 5

✓
0

Question 3

Question 10

✓
FALSE

Question 2

Question 1

Question 4

Question 5

✓
FALSE

Question 1

✓
0

Question 5

Question 2

✓
FALSE

Question 6

Question 1

✓
TRUE
✓
1 mark
✓
1 mark
✓
1 mark
✓
OUTPUT 101000 – 1 mark for each pair of bits.
[6]

Mark scheme 9608_s15_ms_43.pdf →

Show text version of question

Question 6

Part (c)

Question 6

A recursively defined procedure X is defined below:

PROCEDURE X(BYVALUE n : INTEGER) IF (n = 0) OR (n = 1) THEN OUTPUT n ELSE CALL X(n DIV 2) OUTPUT (n MOD 2) ENDIF ENDPROCEDURE

Part (c)

Dry run the procedure X by completing the trace table for the procedure call:

CALL X(40)

Call n (n = 0) OR (n = 1) n DIV 2 n MOD 2 number 1 40 FALSE 20

Question 2

Question 3

Question 4

Question 5

Question 6

OUTPUT ...............................................................................................................................

[6]

Question 15

Topic relevance

Why this question appears here

71% assigned-topic match · Software development › Program testing and maintenance

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

Keep practising this topic