Past-paper question · 2019 October-November · Paper 21 · Q6(a)

Question 6(a) 2019 · October-November · Paper 21 · 1 mark

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

Official answer for Question 6

Part (a)

✓
To retain data when the computer is shut down / turned off // after the program

Question 1

✓
ends

Mark scheme 9608_w19_ms_21.pdf →

Show text version of question

Question 6

Part (a)

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.

A
program is to be written to search the two files and to identify duplicate entries. The account

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
  • empty string.

  • Read each line from the file UserListAtoM.txt
  • Check whether the account number appears in file
  • UserListNtoZ.txt using SearchFileNtoZ() FindDuplicates() • If the account number does appear then add the account number to the array.

  • Output an error message and exit the module if there are more
  • duplicates than can be written to the array.

  • Search for a given account number in file UserListNtoZ.txt
  • SearchFileNtoZ()

  • If found, return TRUE, otherwise return FALSE

Part (a)

State one reason for storing data in a file rather than in an array.

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

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

[1]

Question 13

Topic relevance

Why this question appears here

76% 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

Keep practising this topic