Question 12(b) 2023 · May-June · Paper 31 · 5 marks
Reveal official mark-scheme answer
Official answer for Question 12
Part (b)
Question 5
Question 1
Question 5
Question 2
Question 4
Question 3
Question 3
Question 4
Question 2
Question 5
Question 1
Question 1
Question 1
Question 6
Question 2
Question 1
Question 3
Question 2
Question 4
Question 3
Question 5
Question 5
Show text version of question
Question 12
Part (b)
Part (b)
A Fibonacci sequence is a series of numbers formed by adding together the two preceding
numbers, for example:
0, 1, 1, 2, …
This function calculates and returns values in the Fibonacci sequence and uses recursion.
FUNCTION Fib(Number : INTEGER) RETURNS INTEGER IF Number <= 1 THEN Result ← Number ELSE Result ← Fib(Number – 1) + Fib(Number – 2) ENDIF RETURN Result ENDFUNCTION
Complete the trace table for the function when it is called as Fib(5).
Call number Function call Number Result Return value
Question 5
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge.
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 9618_s23_qp_31.pdf
