Past-paper question · 2018 May-June · Paper 43 · Q6(b)

Question 6(b) 2018 · May-June · Paper 43 · 5 marks

Original past-paper question for 6(B)
Original past-paper question for 6(B)
Original past-paper question for 6(B)
Original past-paper question for 6(B)
Reveal official mark-scheme answer Official mark-scheme answer for 6(B)

Official answer for Question 6

Part (b)

Question 1

mark for each completed statement

Question 5

✓
FUNCTION SearchList(Find, Position) RETURNS INTEGER
✓
IF Scorer[Position].Player = Find
✓
THEN
✓
RETURN Position
✓
ELSE
✓
IF Scorer[Position].Player <> -1
✓
THEN
✓
Position ← SearchList(Find, Scorer[Position].Pointer)
✓
RETURN Position
✓
ELSE
✓
RETURN 99
✓
ENDIF
✓
ENDIF
✓
ENDPROCEDURE

Mark scheme 9608_s18_ms_43.pdf →

Show text version of question

Question 6

Part (b)

Question 6

An Abstract Data Type (ADT) is used to create a linked list. The linked list is created as an array of

records. The records are of type ListNode.

An example of a record of ListNode is shown in the following table.

Data Field Value Player "Alvaro" Pointer 1

Part (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 the linked list is held in the variable ListHead.

After some processing, the array and variables are in the state as follows:

Scorers ListHead Player Pointer 0 0 "Alvaro" 1 1 "Antoine" 3 2 "Dimitri" 7 3 "Cristiano" 2 4 "Gareth" 5 5 "Graziano" 6 6 "Olivier" 8 7 "Erik" 4 8 "Yaya" 9 9 "Zoto" -1

A
recursive function traverses the linked list to search for a player.

An example of calling the function, using pseudocode, is:

Position SearchList("Gareth", ListHead)

Question 17

Complete the following pseudocode to implement the function SearchList().

The function will return a value of 99 when a player is not found.

FUNCTION SearchList(Find : STRING, Position : INTEGER) RETURNS INTEGER

IF Scorer[Position].Player = ..............................................................................

THEN

RETURN ................................................................................................................

ELSE

IF Scorer[Position].Pointer <> –1

THEN

Position SearchList(Find, ..................................................)

RETURN ...................................................................................................

ELSE

RETURN ...................................................................................................

ENDIF

ENDIF

ENDFUNCTION

[5]

Question 18

Question 19

Question 20

reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the publisher will be pleased to make amends at the earliest possible opportunity.

To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge International Examinations Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cie.org.uk after the live examination series.

Cambridge International Examinations is part of the Cambridge Assessment Group. Cambridge Assessment is the brand name of University of Cambridge Local Examinations Syndicate (UCLES), which is itself a department of the University of Cambridge.

Topic relevance

Why this question appears here

98% assigned-topic match · Computational thinking and problem-solving › Recursion

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 9608_s18_qp_43.pdf

Keep practising this topic