Question 3(b) 2024 · May-June · Paper 23 · 5 marks
Reveal official mark-scheme answer
Official answer for Question 3
Part (b)
Question 5
Question 1
Question 2
Question 3
Question 4
Question 5
Show text version of question
Question 3
Part (b)
Question 3
A record structure is declared to hold data relating to components being produced in a factory:
TYPE Component DECLARE Item_ID : STRING DECLARE Reject : BOOLEAN DECLARE Weight : REAL ENDTYPE
The factory normally produces a batch (or set) of 1000 components at a time. A global array is declared to store 1000 records for a batch:
DECLARE Batch : ARRAY [1:1000] OF Component
Two global variables contain the minimum and maximum acceptable weight for each component. The values represent an inclusive range and are declared as:
DECLARE Min, Max : REAL
Part (b)
A module InRange() will:
- be called with an integer parameter representing an index value of a record in the Batch
- check if the weight of the indexed component is within the acceptable range
- return TRUE if the weight is in the range and FALSE if it is not.
array
- iterate through a batch of 1000 component records
- call module InRange() to check each individual component record
- keep a count of the number of components that fail
- output a suitable warning message and immediately stop if the number of failed
components exceeds 5.
Question 7
, ,
Complete the program flowchart to represent the algorithm for module BatchCheck().
START
Is Index = 1001 ?
Yes
No
END
Question 8
, ,
Why this question appears here
99% assigned-topic match · Data types and structures › Data types and records
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_s24_qp_23.pdf
