19.2 Recursion
43 questions in this subtopic. Open a question to solve it and check the official answer.
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. ...................................................................................…
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 …
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]
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 · 5 marks · official answer ready
(i) Complete the pseudocode: 01 PROCEDURE TraverseTree(BYVALUE Root: INTEGER) 02 IF Tree[Root].LeftPointer ................................................................. 03 THE…
Recursion · 2 marks · official answer ready
(ii) Explain what is meant by a recursive procedure. Give a line number from the code above that shows procedure TraverseTree is recursive. .......................................…
Recursion · 1 mark · official answer ready
(iii) Write the pseudocode call required to output all names stored in Tree. ......................................................................................................…
Recursion · 5 marks · official answer ready
(i) Complete the pseudocode: 01 PROCEDURE TraverseTree(BYVALUE Root: INTEGER) 02 IF Tree[Root].LeftPointer ................................................................. 03 THE…
