Question 6(c) 2019 · October-November · Paper 21 · 8 marks
Reveal official mark-scheme answer
Official answer for Question 6
Part (c)
Question 8
Show text version of question
Question 6
Part (c)
Question 6
Account information for users of a library is held in one of two text files; UserListAtoM.txt and
UserListNtoZ.txt
The format of the data held in the two files is identical. Each line of the file is stored as a string that contains an account number, name and telephone number separated by the asterisk character ('*') as follows:
<Account Number>'*'<Name>'*'<Telephone Number>
An example of one line from the file is:
"GB1234*Kevin Mapunga*07789123456"
The account number string may be six or nine characters in length and is unique for each person. It is made up of alphabetic and numeric characters only.
An error has occurred and the same account number has been given to different users in the two files. There is no duplication of account numbers within each individual file.
number of any duplicate found is to be written to an array, Duplicates, which is a 1D array of 100 elements of data type STRING.
The program is to be implemented as several modules. The outline description of three of these is as follows:
Module Outline description
ClearArray()
- Initialise the global array Duplicates. Set all elements to the
- Read each line from the file UserListAtoM.txt
- Check whether the account number appears in file
- Output an error message and exit the module if there are more
- Search for a given account number in file UserListNtoZ.txt
- If found, return TRUE, otherwise return FALSE
empty string.
UserListNtoZ.txt using SearchFileNtoZ() FindDuplicates() • If the account number does appear then add the account number to the array.
duplicates than can be written to the array.
SearchFileNtoZ()
Part (c)
Write pseudocode for the module FindDuplicates().
The module description is given in the table on page 12.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Question 15
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Why this question appears here
87% assigned-topic match · Data types and structures › Files
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_w19_qp_21.pdf
