Computational thinking and problem-solving
49 questions. Open a question to solve it and check the official answer.
Algorithms · 5 marks · official answer ready
1 (a) Algorithms usually consist of three different types of activity. Complete the following table. Write each example statement in program code and state the programming languag…
Algorithms · 3 marks · official answer ready
(c) Explain the benefits of the team using program libraries in the development of the program. ...................................................................................…
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…
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 .............................…
Algorithms · 3 marks · official answer ready
(c) Explain the benefits of the team using program libraries in the development of the program. ...................................................................................…
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…
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 .............................…
Recursion · 2 marks
(a) State two features of recursion. Feature 1 ................................................................................................................................... …
Recursion · 3 marks
(b) Explain what a compiler has to do to implement recursion. .....................................................................................................................…
Recursion · 2 marks
(a) State two features of recursion. Feature 1 ................................................................................................................................... …
Recursion · 3 marks
(b) Explain what a compiler has to do to implement recursion. .....................................................................................................................…
Recursion · 1 mark · official answer ready
(i) State what is meant by a recursive algorithm. .................................................................................................................................…
Recursion · 1 mark · official answer ready
(ii) State the line number in Calculate() where the recursive call takes place. ...................................................................................................…
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…
Recursion · 2 marks · official answer ready
(i) Describe one problem that can occur when running a subroutine that has a recursive algorithm. .................................................................................…
Recursion · 5 marks · official answer ready
(ii) Rewrite the Calculate() function in pseudocode, using an iterative algorithm. ................................................................................................…
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…
Recursion · 1 mark · official answer ready
(i) State what is meant by a recursive algorithm. .................................................................................................................................…
Recursion · 1 mark · official answer ready
(ii) State the line number in Calculate() where the recursive call takes place. ...................................................................................................…
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…
