Computational thinking and problem-solving
17 questions. Open a question to solve it and check the official answer.
Recursion · 1 mark · official answer ready
(i) How can you recognise that this function is recursive? ........................................................................................................................…
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.…
Recursion · 1 mark
(i) State the value returned by Power(3, 0). ......................................................................................................................................…
Recursion · 1 mark · official answer ready
(ii) State the value returned by Power(3, 1). .....................................................................................................................................…
Recursion · 2 marks · official answer ready
(i) Explain what happens when the call is Power(3, -1). ...........................................................................................................................…
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). ...................................................…
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…
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 ..............................…
Recursion · 2 marks · official answer ready
(i) Identify where it is appropriate to set a breakpoint. Justify your answer. ....................................................................................................…
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 ← …
Recursion · 3 marks · official answer ready
(iii) Explain how Ryan uses these debugging tools to check the execution of his recursive function. ...............................................................................…
Recursion · 2 marks · official answer ready
(a) A rule may be recursive. State what is meant by recursive. ....................................................................................................................…
Recursion · 3 marks
6 (a) A rule may be recursive. State what is meant by recursive. ..................................................................................................................…
Recursion · 4 marks
6 (a) A rule may be recursive. State what is meant by recursive. ..................................................................................................................…
Recursion · 2 marks · official answer ready
(a) A rule may be recursive. State what is meant by recursive. ....................................................................................................................…
Recursion · 3 marks
6 (a) A rule may be recursive. State what is meant by recursive. ..................................................................................................................…
Recursion · 4 marks
6 (a) A rule may be recursive. State what is meant by recursive. ..................................................................................................................…
