Question 8(e) 2023 · May-June · Paper 21 · 3 marks
Reveal official mark-scheme answer
Official answer for Question 8
Part (e)
Question 3
Show text version of question
Question 8
Part (e)
Question 8
A computer shop assembles computers using items bought from several suppliers. A text file
Stock.txt contains information about each item.
Information for each item is stored as a single line in the Stock.txt file in the format: <ItemNum><SupplierCode><Description>
Item information is as follows:
Format Comment unique for each item in the range ItemNum 4 numeric characters "0001" to "5999" inclusive
SupplierCode 5 alphabetic characters to identify the supplier of the item
Description a string a minimum of 12 characters
The file is organised in ascending order of ItemNum and does not contain all possible values in the range.
Module Description SuppExists() • called with a parameter of type string representing a supplier code (already written)
- returns TRUE if the supplier code is already in use, otherwise returns
- returns TRUE if the string only contains alphabetic characters (either
FALSE IsNewSupp() • called with a parameter of type string representing a new supplier code
upper or lower case) and the supplier code is not already in use, otherwise returns FALSE
Question 15
Part (e)
A new module FindItem() searches for a given item in the Stock.txt file, which is already
organised in ascending order of ItemNum.
Describe how this organisation may improve the efficiency of the algorithm.
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
Question 18
Question 19
Question 20
reasonable effort has been made by the publisher (UCLES) to trace copyright holders, but if any items requiring clearance have unwittingly been included, the publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge Local Examinations Syndicate (UCLES), which is a department of the University of Cambridge.
Why this question appears here
71% assigned-topic match · Programming › Constructs
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 9618_s23_qp_21.pdf
