19.2 Recursion
47 questions in this subtopic. Open a question to solve it and check the official answer.
Recursion · 1 mark · official answer ready
(iii) Test your program. Take a screenshot of the output(s). Save your program. Copy and paste the screenshot into part 3(c)(iii) in the evidence document. [1] 13
Recursion · 6 marks · official answer ready
(i) Write program code for the recursive function BinarySearch(). Save your program. Copy and paste the program code into part 3(d)(i) in the evidence document. [6]
Recursion · 2 marks · official answer ready
(ii) Write program code to amend the main program to: • call BinarySearch()with the sorted array and the integer 644 as the search value • output ‘Not found’ if 644 is not found i…
Recursion · 1 mark · official answer ready
(iii) Test your program. Take a screenshot of the output(s). Save your program. Copy and paste the screenshot into part 3(d)(iii) in the evidence document. [1] 14 15 16 Permission…
Recursion · 4 marks · official answer ready
(c) Explain how a compiler makes use of a stack when translating recursive programming code. ......................................................................................…
Recursion · 6 marks · official answer ready
(i) Rewrite the function IterativeVowels() as a recursive function with the identifier RecursiveVowels(). Save your program. Copy and paste the program code into part 1(b)(i) in t…
Recursion · 2 marks · official answer ready
12 (a) Describe what is meant by recursion. .......................................................................................................................................…
Recursion · 5 marks · official answer ready
(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 …
Recursion · 2 marks · official answer ready
12 (a) Describe what is meant by recursion. .......................................................................................................................................…
Recursion · 5 marks · official answer ready
(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 …
Recursion · 6 marks · official answer ready
(d) The following iterative pseudocode function calculates the total of all the values stored in the queue. FUNCTION IterativeOutput(Start: INTEGER) RETURNS INTEGER DECLARE Total …
Recursion · 1 mark · official answer ready
(i) Amend the main program by writing program code to perform this task. Save your program. Copy and paste the program code into part 3(e)(i) in the evidence document. [1]
Recursion · 1 mark · official answer ready
(ii) Test your program. Take a screenshot to show the output. Copy and paste the screenshot into part 3(e)(ii) in the evidence document. [1] 10 11 12 reasonable effort has been ma…
Recursion · 5 marks · official answer ready
(c) The following recursive pseudocode function searches the binary tree for a given value. If the value is found, the function must return the index of the value. If the value is…
Recursion · 7 marks · official answer ready
(d) A post order traversal performs the following operation: • visit the left node • visit the right node • output the root. For example, in the following tree, the output would b…
Recursion · 7 marks
6 –1 –1 –1 FreeNode stores the index of the first free element in the array, initialised to 6. RootPointer stores the index of the first node in the tree, initialised to 0. Amend …
Recursion · 9 marks
6 –1 –1 –1 FreeNode stores the index of the first free element in the array, initialised to 6. RootPointer stores the index of the first node in the tree, initialised to 0. Amend …
Recursion · 3 marks · official answer ready
10 (a) State three essential features of recursion. 1 .............................................................................................................................…
Recursion · 3 marks · official answer ready
(b) Explain the reasons why a stack is a suitable Abstract Data Type (ADT) to implement recursion. ................................................................................…
Recursion · 3 marks · official answer ready
(a) Write program code to declare the function Unknown(). Save your program as question 1. Copy and paste the program code into part 1(a) in the evidence document. [3] 3
