Past-paper question · 2017 October-November · Paper 23 · Q5(a)

Question 5(a) 2017 · October-November · Paper 23 · 8 marks

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

Official answer for Question 5

Part (a)

✓
PROCEDURE MakeNewfile

Question 8

✓
DECLARE OldFileLine : STRING
✓
DECLARE NewFileLine : STRING
✓
OPENFILE "EmailDetails" FOR READ
✓
OPENFILE "NewEmailDetails" FOR WRITE
✓
WHILE NOT EOF("EmailDetails")
✓
READFILE "EmailDetails", OldFileLine
✓
NewFileLine ← "00" & OldFileLine
✓
WRITEFILE "NewEmailDetails", NewFileLine
✓
ENDWHILE
✓
CLOSEFILE "EmailDetails"
✓
CLOSEFILE "NewEmailDetails"
✓
ENDPROCEDURE
✓
Mark as follows:
✓
1. Variable declaration of STRING for OldFileLine (or equivalent)
✓
2.
✓
Open EmailDetails for READ
✓
3.
✓
Open NewEmailDetails for WRITE
✓
4.
✓
Correct loop checking for EOF(EmailDetails)
✓
5.
✓
Reading a line from EmailDetails in a loop
✓
6.
✓
Correct concatenation in a loop
✓
7.
✓
Writing a line to NewEmailDetails in a loop
✓
Closing both files

Mark scheme 9608_w17_ms_23.pdf →

Show text version of question

Question 5

Part (a)

Question 5

A sports club maintains a record of the email address of each of its members. The details are

stored in a text file, EmailDetails.txt. The format of each line of the text file is as follows:

<MembershipNumber><EmailAddress>

  • MembershipNumber is a four-character string of numerals.
  • EmailAddress is a variable-length string.

Membership of the club has increased and a four-character membership number is no longer adequate.

A
procedure, MakeNewFile, is required to perform the following actions:

1. Create a new file, NewEmailDetails.txt 2. Read a line from file EmailDetails.txt 3. Extend MembershipNumber by adding two leading zero digits (for example, "1234" becomes "001234") 4. Write the new line to file NewEmailDetails.txt 5. Repeat steps 2 to 4 for all lines in the original file.

Part (a)

Write pseudocode for the procedure MakeNewFile.

For the built-in functions list, refer to the Appendix on page 14.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

...............................................................................................................................................[8]

Question 13

Topic relevance

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_w17_qp_23.pdf

Keep practising this topic