Skip to main content
A-LevelComputer ScienceData types and structures9618/33 · May/June 2023 · Q127 Marks

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).

  1. (a)Describe what is meant by recursion.[2]
  2. (b)Complete the trace table for the function when it is called as Fib(5). Call number Function call Number Result Return value[5]

Mark scheme

Marking points from the official mark scheme (May/June 2023). The mark or mark type is shown in brackets.

  1. [1] A process using a function or procedure defined in terms of itself / calls itself.
  2. [1] A recursive process must have a base case (which is a way to return without making a recursive call) // terminating solution // concept of unwinding described
  3. [1] There must (also) be a general case where the recursive call takes place.
  4. [1] Call number column correct
  5. [1] Function call and Number columns correct
  6. [1] Result column down to base case (Winding) rows 1–6 correct
  7. [1] Result column down from base case (Unwinding) rows 7–10 correct
  8. [1] Return value column correct

Write your answer and get it marked

On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.

Sign up free →

About this question

Topic
Data types and structures, A-Level Computer Science (syllabus 9618). Structured question, 7 marks.
Source
A-Level Computer Science, May/June 2023 Paper 3 Variant 3, question 12.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep