Skip to main content
A-LevelComputer ScienceData types and structures9618/23 · May/June 2024 · Q39 Marks

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

  1. (a)(i)A program uses a variable This Index as the array index to access a record. Write a pseudocode clause to check whether or not the weight of an individual component is within the acceptable range.[3]
  2. (a)(ii)When batches of less than 1000 components are processed, it is necessary to indicate that certain elements in the array are unused. Suggest how an unused array element could be indicated.[1]
  3. (b)A module InRange() will: • be called with an integer parameter representing an index value of a record in the Batch array • 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. A module BatchCheck() will: • 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. Complete the program flowchart to represent the algorithm for module BatchCheck(). [Figure 3.1][5]

This question uses a diagram from the original paper, which isn't shown here. Open the full paper from the past papers archive to see it.

Mark scheme

Marking points from the official mark scheme (May/June 2024). The mark or mark type is shown in brackets.

  1. [1] (a)(i) Reference to Batch[ThisIndex].Weight
  2. [1] (a)(i) A valid check for one boundary (e.g., >= Min)
  3. [1] (a)(i) A valid check for other boundary (e.g., <= Max) with correct logic operator (AND for inclusion)
  4. [1] (a)(i) ALTERNATIVE: A valid check for one boundary (e.g., < Min)
  5. [1] (a)(i) ALTERNATIVE: A valid check for other boundary (e.g., > Max) with correct logic operator (OR for exclusion)
  6. [1] (a)(ii) Set the Item ID field to an empty string / NULL / invalid value
  7. [1] (a)(ii) Set Weight to <= 0 / zero
  8. [1] (b) Zone 1: START, Set Index to 0, Set Count to 0
  9. [1] (b) Zone 2: Set Index to Index + 1, Is Index = 1001? (Diamond)
  10. [1] (b) Zone 3: Is InRange (Index) = TRUE? (Diamond)
  11. [1] (b) Zone 4: Set Count to Count + 1
  12. [1] (b) Zone 5: Is Count > 5? (Diamond), OUTPUT "Reject Batch", END

Write your answer and get it marked

On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.

Sign up free →

About this question

Topic
Data types and structures, A-Level Computer Science (syllabus 9618). Structured question, 9 marks.
Source
A-Level Computer Science, May/June 2024 Paper 2 Variant 3, question 3.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep