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

Question 6(a)(ii) 2019 · October-November · Paper 23 · 8 marks

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

Official answer for Question 6

Part (a)

(ii)

✓
'Pseudocode' solution included here for development and clarification of

Question 8

✓
mark scheme.
✓
Programming language example solutions appear in the Appendix.
✓
FUNCTION FindBooksBy(SearchAuthor : STRING) RETURNS
✓
INTEGER
✓
DECLARE
✓
Title : STRING
✓
DECLARE
✓
Author : STRING
✓
DECLARE
✓
Isbn : STRING
✓
DECLARE
✓
Location : STRING
✓
DECLARE
✓
Count : INTEGER
✓
Count ← 0
✓
OPENFILE "Library.txt" FOR READ
✓
WHILE NOT EOF ("Library.txt")
✓
READFILE
✓
"Library.txt",
✓
Title
✓
READFILE
✓
"Library.txt",
✓
ThisAuthor
✓
READFILE
✓
"Library.txt",
✓
ISBN
✓
READFILE
✓
"Library.txt",
✓
Location
✓
IF SearchAuthor = ThisAuthor
✓
THEN
✓
Result[Count, 0] ← Title
✓
Result[Count, 1] ← Location
✓
Count ← Count + 1
✓
ENDIF
✓
ENDWHILE
✓
CLOSEFILE("Library.txt")
✓
RETURN Count
✓
ENDFUNCTION
✓
One mark for each of the following:

Mark scheme 9608_w19_ms_23.pdf →

Show text version of question

Question 6

Part (a)

(ii)

Question 6

A text file, Library.txt, stores information relating to a book collection. The file stores four

pieces of information about each book on separate lines of the file, as follows:

Line n: <Book Title> Line n + 1: <Author Name> Line n + 2: <ISBN> Line n + 3: <Location>

Information is stored as data strings.

Information relating to two books is shown:

File line Data 100 "Learning Python"

101 "Brian Smith"

103 "BD345"

104 "Surviving in the mountains"

105 "C T Snow"

107 "ZX001"

(ii)

Function FindBooksBy() will:

  • receive the Author Name as a parameter
  • search Library.txt for matching entries
  • store the Book Title and Location of matching entries in the Result array
  • return an integer value giving the number of books by the author that were found.

Question 13

Write program code for the function FindBooksBy().

Visual Basic and Pascal: You should include the declaration statements for variables. Python: You should show a comment statement for each variable used with its data type.

Programming language .....................................................................................................

Program code

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Question 14

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

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

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

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

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

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

[8]
Topic relevance

Why this question appears here

71% assigned-topic match · Programming › Structured programming

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

Keep practising this topic