Past-paper question · 2013 May-June · Paper 33 · Q4(d)(ii)

Question 4(d)(ii) 2013 · May-June · Paper 33 · 8 marks

Original past-paper question for 4(D)(II)
Original past-paper question for 4(D)(II)
Original past-paper question for 4(D)(II)
Original past-paper question for 4(D)(II)
Original past-paper question for 4(D)(II)
Reveal official mark-scheme answer Official mark-scheme answer for 4(D)(II)

Official answer for Question 4

Part (d)

(ii)

(ii)

✓
ListTraversal(3)
✓
MyList[3].Pointer <> 0 is TRUE
✓
ListTraversal(1)
✓
MyList[1].Pointer <> 0 is TRUE
✓
ListTraversal(2)
✓
MyList[2].Pointer <> 0 is TRUE
✓
ListTraversal(4)
✓
MyList[4].Pointer <> 0 is FALSE
✓
OUTPUT MyList[4].Data // OUTPUT PEPPER
✓
ENDPROCEDURE
✓
OUTPUT COURGETTE
✓
ENDPROCEDURE
✓
OUTPUT BEAN
✓
ENDPROCEDURE
✓
OUTPUT APPLE
✓
ENDPROCEDURE
[4]

Mark scheme 9691_s13_ms_33.pdf →

Show text version of question

Question 4

Part (d)

(ii)

Question 4

A linked list is implemented with an array of records of data type Node. For

Examiner's Use The Node record has two fields as defined below:

RECORD Node Data : STRING Pointer : INTEGER ENDRECORD

A
program is to create a linked list using the array and variable shown below.

Identifier Data Type Description

MyList ARRAY[100] OF Node An array to store the data and pointer values

HeadPointer INTEGER Stores the index position of the node at the head of the linked list The following algorithm traverses the linked list and outputs the data values. For Examiner's Use PROCEDURE ListTraversal(Index) IF MyList[Index].Pointer <> 0 THEN // follow the pointer to the next node ListTraversal(MyList[Index].Pointer) ENDIF OUTPUT MyList[Index].Data ENDPROCEDURE

(ii)

The diagram shows a trace of the execution of this algorithm for the given linked

list data.

HeadPointer: 3

MyList Data Pointer 1 BEAN 2

2 COURGETTE 4

3 APPLE 1

4 PEPPER 0

...

Question 99

100

Question 13

Fill in the missing lines of pseudocode. For Examiner's Use ListTraversal(3) MyList[3].Pointer <> 0 is TRUE ListTraversal(1) MyList[1].Pointer <> 0 is TRUE ListTraversal(2)

.................................................................. ListTraversal(4)

...................................................

................................................... ENDPROCEDURE OUTPUT COURGETTE ENDPROCEDURE OUTPUT BEAN

......................... OUTPUT APPLE ENDPROCEDURE

[4]
Topic relevance

Why this question appears here

71% assigned-topic match · Algorithm design and problem-solving › Algorithms

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 9691_s13_qp_33.pdf

Keep practising this topic