Computer Science For First Examination In 2021 9618 · 19

19.2 Recursion

47 questions in this subtopic. Open a question to solve it and check the official answer.

Reset
2024 May-June · Paper 42 · Q3(c)(iii)

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

2024 May-June · Paper 42 · Q3(d)(i)

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]

2024 May-June · Paper 42 · Q3(d)(ii)

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…

2024 May-June · Paper 42 · Q3(d)(iii)

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…

2023 October-November · Paper 32 · Q9(c)

Recursion · 4 marks · official answer ready

(c) Explain how a compiler makes use of a stack when translating recursive programming code. ......................................................................................…

2023 October-November · Paper 41 · Q1(b)(i)

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…

2023 May-June · Paper 31 · Q12(a)

Recursion · 2 marks · official answer ready

12 (a) Describe what is meant by recursion. .......................................................................................................................................…

2023 May-June · Paper 31 · Q12(b)

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 …

2023 May-June · Paper 33 · Q12(a)

Recursion · 2 marks · official answer ready

12 (a) Describe what is meant by recursion. .......................................................................................................................................…

2023 May-June · Paper 33 · Q12(b)

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 …

2022 October-November · Paper 42 · Q3(d)

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 …

2022 October-November · Paper 42 · Q3(e)(i)

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]

2022 October-November · Paper 42 · Q3(e)(ii)

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…

2022 October-November · Paper 43 · Q3(c)

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…

2022 October-November · Paper 43 · Q3(d)

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…

2022 October-November · Paper 43 · Q6(c)

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 …

2022 October-November · Paper 43 · Q6(d)

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 …

2021 October-November · Paper 31 · Q10(a)

Recursion · 3 marks · official answer ready

10 (a) State three essential features of recursion. 1 .............................................................................................................................…

2021 October-November · Paper 31 · Q10(b)

Recursion · 3 marks · official answer ready

(b) Explain the reasons why a stack is a suitable Abstract Data Type (ADT) to implement recursion. ................................................................................…

2021 October-November · Paper 41 · Q1(a)

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