Computer Science 9608 · 19

19.2 Recursion

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

Reset
2021 May-June · Paper 41 · Q4(b)(iii)

Recursion · 6 marks · official answer ready

(iii) A pre-order traversal on the following tree would output M C A G R L W M C R A G L W The pre-order traversal can be written as a recursive procedure: 1. output the root node…

2021 May-June · Paper 41 · Q5(b)

Recursion · 5 marks · official answer ready

(b) The binary search algorithm can be written recursively. Write program code for a recursive function recursiveBinarySearch(). Programming language .............................…

2021 May-June · Paper 43 · Q4(b)(iii)

Recursion · 6 marks · official answer ready

(iii) A pre-order traversal on the following tree would output M C A G R L W M C R A G L W The pre-order traversal can be written as a recursive procedure: 1. output the root node…

2021 May-June · Paper 43 · Q5(b)

Recursion · 5 marks · official answer ready

(b) The binary search algorithm can be written recursively. Write program code for a recursive function recursiveBinarySearch(). Programming language .............................…

2019 May-June · Paper 41 · Q3(a)

Recursion · 2 marks

(a) State two features of recursion. Feature 1 ................................................................................................................................... …

2019 May-June · Paper 41 · Q3(b)

Recursion · 3 marks

(b) Explain what a compiler has to do to implement recursion. .....................................................................................................................…

2019 May-June · Paper 43 · Q3(a)

Recursion · 2 marks

(a) State two features of recursion. Feature 1 ................................................................................................................................... …

2019 May-June · Paper 43 · Q3(b)

Recursion · 3 marks

(b) Explain what a compiler has to do to implement recursion. .....................................................................................................................…

2018 October-November · Paper 41 · Q4(a)(i)

Recursion · 1 mark · official answer ready

(i) State what is meant by a recursive algorithm. .................................................................................................................................…

2018 October-November · Paper 41 · Q4(a)(ii)

Recursion · 1 mark · official answer ready

(ii) State the line number in Calculate() where the recursive call takes place. ...................................................................................................…

2018 October-November · Paper 41 · Q4(b)

Recursion · 6 marks · official answer ready

(b) The function is called with Calculate(3). Dry run the function and complete the trace table below. State the final value returned. Show your working. 01 FUNCTION Calculate(BYV…

2018 October-November · Paper 41 · Q4(c)(i)

Recursion · 2 marks · official answer ready

(i) Describe one problem that can occur when running a subroutine that has a recursive algorithm. .................................................................................…

2018 October-November · Paper 41 · Q4(c)(ii)

Recursion · 5 marks · official answer ready

(ii) Rewrite the Calculate() function in pseudocode, using an iterative algorithm. ................................................................................................…

2018 October-November · Paper 42 · Q6(b)

Recursion · 5 marks · official answer ready

(b) The program stores the position of the last node in the linked list in LastNode. The last node always has a Pointer value of -1. The position of the node at the head of the li…

2018 October-November · Paper 43 · Q4(a)(i)

Recursion · 1 mark · official answer ready

(i) State what is meant by a recursive algorithm. .................................................................................................................................…

2018 October-November · Paper 43 · Q4(a)(ii)

Recursion · 1 mark · official answer ready

(ii) State the line number in Calculate() where the recursive call takes place. ...................................................................................................…

2018 October-November · Paper 43 · Q4(b)

Recursion · 6 marks · official answer ready

(b) The function is called with Calculate(3). Dry run the function and complete the trace table below. State the final value returned. Show your working. 01 FUNCTION Calculate(BYV…

2018 October-November · Paper 43 · Q4(c)(i)

Recursion · 2 marks · official answer ready

(i) Describe one problem that can occur when running a subroutine that has a recursive algorithm. .................................................................................…

2018 October-November · Paper 43 · Q4(c)(ii)

Recursion · 5 marks · official answer ready

(ii) Rewrite the Calculate() function in pseudocode, using an iterative algorithm. ................................................................................................…

2018 May-June · Paper 41 · Q6(b)

Recursion · 5 marks · official answer ready

(b) The linked list stores ListNode records in alphabetical order of player. The last node in the linked list always has a Pointer value of –1. The position of the first node in t…