Question 8(b) 2023 · May-June · Paper 21 · 7 marks
Reveal official mark-scheme answer
Official answer for Question 8
Part (b)
Question 7
Question 1
Question 2
Question 3
Question 4
Question 5
Question 6
Question 7
Question 8
Show text version of question
Question 8
Part (b)
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 (b)
A new module has been defined:
Module Description CheckNewItem() • called with a parameter of type string representing a line of item information
- checks to see whether an item with the same ItemNum already
- returns TRUE if the ItemNum is not already in the file, otherwise
exists in the file
returns FALSE
Write efficient pseudocode for module CheckNewItem().
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
Question 17
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
.............................................................................................................................................
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
