Question 1(c)(ii) 2016 · May-June · Paper 42 · 6 marks
Reveal official mark-scheme answer
Official answer for Question 1
Part (c)
(ii)
Show text version of question
Question 1
Part (c)
(ii)
Question 1
A linked list abstract data type (ADT) is to be used to store and organise surnames.
This will be implemented with a 1D array and a start pointer. Elements of the array consist of a user-defined type. The user-defined type consists of a data value and a link pointer.
Identifier Data type Description LinkedList RECORD User-defined type Surname STRING Surname string Ptr INTEGER Link pointers for the linked list Pseudocode is to be written to search the linked list for a surname input by the user.
Identifier Data type Description ThisSurname STRING The surname to search for Current INTEGER Index to array SurnameList Index to array SurnameList. Points to the StartPtr INTEGER element at the start of the linked list
(ii)
Complete the pseudocode.
01 Current ← .............................................................................................................. 02 IF Current = 0 03 THEN 04 OUTPUT ......................................................................................................... 05 ELSE 06 IsFound ← ................................................................................................. 07 INPUT ThisSurname 08 REPEAT 09 IF ............................................................................. = ThisSurname 10 THEN 11 IsFound ← TRUE 12 OUTPUT "Surname found at position ", Current 13 ELSE 14 // move to the next list item 15 ..................................................................................................... 16 ENDIF 17 UNTIL IsFound = TRUE OR ..................................................................... 18 IF IsFound = FALSE 19 THEN 20 OUTPUT "Not Found" 21 ENDIF 22 ENDIF
Question 4
Why this question appears here
72% assigned-topic match · Hardware › Logic gates and logic circuits
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_s16_qp_42.pdf
