Question 6(b) 2018 · May-June · Paper 41 · 5 marks
Reveal official mark-scheme answer
Official answer for Question 6
Part (b)
Question 1
mark for each completed statement
Question 5
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
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
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.
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_41.pdf
