Question 6(b) 2015 · May-June · Paper 43 · 2 marks
Reveal official mark-scheme answer
Official answer for Question 6
Part (b)
Part (b)
Before procedure call is executed current state of the registers/local variables is saved onto
Show text version of question
Question 6
Part (b)
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 (b)
Explain how a stack is used during the execution of a recursive procedure.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
..............................................................................................................................................
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_s15_qp_43.pdf
