Computing 9691 · 19

19.2 Recursion

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

Reset
2016 May-June · Paper 22 · Q2(a)(i)

Recursion · 1 mark · official answer ready

(i) How can you recognise that this function is recursive? ........................................................................................................................…

2016 May-June · Paper 22 · Q2(a)(ii)

Recursion · 2 marks · official answer ready

(ii) A recursive solution to a problem always has a base case (the stopping condition) and a general case. Give the line number of the statement that is executed in the base case.…

2016 May-June · Paper 22 · Q2(b)(i)

Recursion · 1 mark

(i) State the value returned by Power(3, 0). ......................................................................................................................................…

2016 May-June · Paper 22 · Q2(b)(ii)

Recursion · 1 mark · official answer ready

(ii) State the value returned by Power(3, 1). .....................................................................................................................................…

2016 May-June · Paper 22 · Q2(c)(i)

Recursion · 2 marks · official answer ready

(i) Explain what happens when the call is Power(3, -1). ...........................................................................................................................…

2016 May-June · Paper 22 · Q2(c)(ii)

Recursion · 2 marks · official answer ready

(ii) Describe the changes that will need to be made to function Power to address the problem that you described in part (c)(i). ...................................................…

2016 May-June · Paper 22 · Q2(d)

Recursion · 4 marks · official answer ready

(d) An alternative method for the Power function is to use an iterative solution. Using pseudocode, write Power as an iterative function. FUNCTION Power(Number : INTEGER, Exponent…

2016 May-June · Paper 22 · Q2(e)

Recursion · 2 marks · official answer ready

(e) A problem may have both an iterative solution and a recursive solution. Each has its own benefits. State one benefit of each solution. Iterative ..............................…

2016 May-June · Paper 22 · Q2(f)(i)

Recursion · 2 marks · official answer ready

(i) Identify where it is appropriate to set a breakpoint. Justify your answer. ....................................................................................................…

2016 May-June · Paper 22 · Q2(f)(ii)

Recursion · 2 marks · official answer ready

(ii) Ryan wants to set up a variable watch window for his function. 01 FUNCTION Power(Number : INTEGER, Exponent : INTEGER) RETURNS INTEGER 02 IF Exponent = 0 03 THEN 04 Result ← …

2016 May-June · Paper 22 · Q2(f)(iii)

Recursion · 3 marks · official answer ready

(iii) Explain how Ryan uses these debugging tools to check the execution of his recursive function. ...............................................................................…

2016 May-June · Paper 31 · Q6(a)

Recursion · 2 marks · official answer ready

(a) A rule may be recursive. State what is meant by recursive. ....................................................................................................................…

2016 May-June · Paper 31 · Q6(a)(i)

Recursion · 3 marks

6 (a) A rule may be recursive. State what is meant by recursive. ..................................................................................................................…

2016 May-June · Paper 31 · Q6(a)(ii)

Recursion · 4 marks

6 (a) A rule may be recursive. State what is meant by recursive. ..................................................................................................................…

2016 May-June · Paper 32 · Q6(a)

Recursion · 2 marks · official answer ready

(a) A rule may be recursive. State what is meant by recursive. ....................................................................................................................…

2016 May-June · Paper 32 · Q6(a)(i)

Recursion · 3 marks

6 (a) A rule may be recursive. State what is meant by recursive. ..................................................................................................................…

2016 May-June · Paper 32 · Q6(a)(ii)

Recursion · 4 marks

6 (a) A rule may be recursive. State what is meant by recursive. ..................................................................................................................…