Computer Science 9608 · 19

19.2 Recursion

43 questions in this subtopic. Open a question to solve it and check the official answer.

Reset
2018 May-June · Paper 42 · Q2(d)

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 ......…

2018 May-June · Paper 42 · Q6(b)

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…

2018 May-June · Paper 43 · Q6(b)

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…

2017 October-November · Paper 22 · Q1(c)

Recursion · 3 marks · official answer ready

(c) Functions and procedures are subroutines. Explain why parameters are used with subroutines. ...................................................................................…

2017 May-June · Paper 41 · Q3

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 …

2017 May-June · Paper 42 · Q2(e)

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…

2017 May-June · Paper 43 · Q3

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 …

2016 May-June · Paper 41 · Q2(a)(ii)

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]

2016 May-June · Paper 41 · Q2(b)(i)

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]

2016 May-June · Paper 41 · Q2(b)(ii)

Recursion · 1 mark · official answer ready

(ii) State the purpose of procedure X when used with the array MyList. ............................................................................................................…

2016 May-June · Paper 42 · Q2(a)(ii)

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]

2016 May-June · Paper 42 · Q2(b)(i)

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]

2016 May-June · Paper 42 · Q2(b)(ii)

Recursion · 1 mark · official answer ready

(ii) State the purpose of procedure X when used with the array MyList. ............................................................................................................…

2016 May-June · Paper 43 · Q2(a)(ii)

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]

2016 May-June · Paper 43 · Q2(b)(i)

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]

2016 May-June · Paper 43 · Q2(b)(ii)

Recursion · 1 mark · official answer ready

(ii) State the purpose of procedure X when used with the array MyList. ............................................................................................................…

2015 October-November · Paper 41 · Q4(c)(i)

Recursion · 5 marks · official answer ready

(i) Complete the pseudocode: 01 PROCEDURE TraverseTree(BYVALUE Root: INTEGER) 02 IF Tree[Root].LeftPointer ................................................................. 03 THE…

2015 October-November · Paper 41 · Q4(c)(ii)

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. .......................................…

2015 October-November · Paper 41 · Q4(c)(iii)

Recursion · 1 mark · official answer ready

(iii) Write the pseudocode call required to output all names stored in Tree. ......................................................................................................…

2015 October-November · Paper 43 · Q4(c)(i)

Recursion · 5 marks · official answer ready

(i) Complete the pseudocode: 01 PROCEDURE TraverseTree(BYVALUE Root: INTEGER) 02 IF Tree[Root].LeftPointer ................................................................. 03 THE…