Computational thinking and problem-solving
60 questions. Open a question to solve it and check the official answer.
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
Recursion · 3 marks · official answer ready
(i) For each of the three function calls, the main program needs to: • output the value of the two parameters • call the function with those parameters • output the return value. …
Recursion · 2 marks · official answer ready
(ii) Take a screenshot to show the output from part (b)(i). Copy and paste the screenshot into part 1(b)(ii) in the evidence document. [2]
Recursion · 7 marks · official answer ready
(c) Rewrite the function Unknown() as an iterative function, IterativeUnknown(). Save your program. Copy and paste the program code into part 1(c) in the evidence document. [7]
Recursion · 1 mark · official answer ready
(i) For each of the three function calls, the main program needs to: • output the value of the two parameters • call the iterative function with those parameters • output the retu…
Recursion · 1 mark · official answer ready
(ii) Take one or more screenshots to show the output of both functions for each set of parameters. Copy and paste the screenshot(s) into part 1(d)(ii) in the evidence document. [1…
Recursion · 9 marks
4 Take a screenshot to show the output after the given data are entered. Copy and paste the screenshot into part 3(d)(ii) in the evidence document. [1] 11 (e) An in-order tree tra…
Recursion · 8 marks
4 Take a screenshot to show the output after the given data are entered. Copy and paste the screenshot into part 3(d)(ii) in the evidence document. [1] 11 (e) An in-order tree tra…
Algorithms · 1 mark · official answer ready
(c) INPUT x IF NOT(x = "Red" OR x = "Yellow" OR x = "Blue") THEN OUTPUT "Invalid" ENDIF ...........................................................................................…
Algorithms · 1 mark · official answer ready
(c) INPUT x IF NOT(x = "Red" OR x = "Yellow" OR x = "Blue") THEN OUTPUT "Invalid" ENDIF ...........................................................................................…
Algorithms · 5 marks · official answer ready
5 (a) Calculate the shortest distance between the base and each of the other towns in the diagram using Dijkstra’s algorithm. Show your working and write your answers in the table…
Algorithms · 5 marks · official answer ready
5 (a) Calculate the shortest distance between the base and each of the other towns in the diagram using Dijkstra’s algorithm. Show your working and write your answers in the table…
Algorithms · 5 marks · official answer ready
5 (a) Calculate the shortest distance between the base and each of the other towns in the diagram using Dijkstra’s algorithm. Show your working and write your answers in the table…
