Question 6(c) 2015 · May-June · Paper 43 · 6 marks
Reveal official mark-scheme answer
Official answer for Question 6
Part (c)
Part (c)
Question 1
Question 40
Question 20
Question 10
Question 2
Question 20
Question 5
Question 3
Question 10
Question 2
Question 1
Question 4
Question 5
Question 1
Question 5
Question 2
Question 6
Question 1
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 ...............................................................................................................................
Question 15
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
