Computational thinking and problem-solving
49 questions. Open a question to solve it and check the official answer.
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 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…
Recursion · 3 marks · official answer ready
(d) All iguanas and lizards are squamata. All squamata are reptiles. Write a recursive rule to make all lizards and iguanas inherit the properties of reptiles. has(X, Y) IF ......…
Recursion · 8 marks · official answer ready
(b) A new command has been added to initialise the pointers of the binary tree to − 1 to indicate they are not in use. A leaf is a node of the binary tree which has no children. I…
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…
Recursion · 3 marks · official answer ready
(c) Functions and procedures are subroutines. Explain why parameters are used with subroutines. ...................................................................................…
Algorithms · 0 marks · official answer ready
1 (a) Simple algorithms usually consist of input, process and output. The statements in the following table are in a generic programming language. Complete the table by placing ti…
Recursion · 7 marks · official answer ready
3 NameList is a 1D array that stores a sorted list of names. A programmer declares the array in pseudocode as follows: NameList : Array[0 : 100] OF STRING The programmer wants to …
Recursion · 5 marks · official answer ready
(e) The traverse tree operation outputs the data items in alphabetical order. This can be written as a recursive solution. Complete the pseudocode for the recursive procedure Trav…
Recursion · 7 marks · official answer ready
3 NameList is a 1D array that stores a sorted list of names. A programmer declares the array in pseudocode as follows: NameList : Array[0 : 100] OF STRING The programmer wants to …
Algorithms · 4 marks
6 0 0 135 0 0 When a particular page of the process is currently in main memory, the Presence flag entry in the page table is set to 1. If the page is not currently present in mem…
Algorithms · 4 marks
6 0 0 135 0 0 When a particular page of the process is currently in main memory, the Presence flag entry in the page table is set to 1. If the page is not currently present in mem…
Recursion · 1 mark · official answer ready
(ii) Write the line number from the pseudocode shown in part (b) that shows the procedure X is recursive. .............................. [1]
Recursion · 4 marks · official answer ready
(i) Complete the trace table for the dry-run of the pseudocode for the procedure CALL X(1, 9). MyList Index Item 1 2 3 4 5 6 7 8 9 10 [4]
Recursion · 1 mark · official answer ready
(ii) State the purpose of procedure X when used with the array MyList. ............................................................................................................…
Recursion · 1 mark · official answer ready
(ii) Write the line number from the pseudocode shown in part (b) that shows the procedure X is recursive. .............................. [1]
Recursion · 4 marks · official answer ready
(i) Complete the trace table for the dry-run of the pseudocode for the procedure CALL X(1, 9). MyList Index Item 1 2 3 4 5 6 7 8 9 10 [4]
Recursion · 1 mark · official answer ready
(ii) State the purpose of procedure X when used with the array MyList. ............................................................................................................…
Recursion · 1 mark · official answer ready
(ii) Write the line number from the pseudocode shown in part (b) that shows the procedure X is recursive. .............................. [1]
