5Hard
0/9

A high-altitude research balloon has several helium pressure chambers monitored by automated sensors. If a chamber's pressure falls outside the safe working range, the flight control system must immediately log a critical warning.

  • The target pressure for each chamber is 100 kPa.
  • The permissible pressure tolerance is plus or minus fifteen kilopascals (inclusive range of 85 kPa to 115 kPa).
  • Only chambers with pressures strictly outside this tolerance (less than 85 kPa or greater than 115 kPa) are considered critical.
  • An output warning message must be displayed to show the index and pressure of any critical chamber.
  • The warning message for each critical chamber must be on a single line.
  • No other messages should be displayed.
  • A global data structure holding the pressures is provided and must be used as part of the solution.

SET chamberPressures TO [100, 85, 120, 95, 70, 115, 130, 90]

  • The solution should work even if the number of chambers in the data structure is changed.

An example output for the dataset above is shown:

Chamber 2 is critical: 120 kPa
Chamber 4 is critical: 70 kPa
Chamber 6 is critical: 130 kPa

Write an algorithm to display critical warnings for any faulty chambers. Use pseudocode or a programming language with which you are familiar.

[9]

Constructs Questions

Practise Edexcel GCSE Computer Science Constructs with exam-style questions for GCSE Computer Science. 61 questions covering Structural components of programs and Writing programs with control constructs, matched to the Edexcel GCSE Computer Science (1CP2) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.

PreviousNext

Constructs Questions

  1. GCSE
  2. /Computer Science
  3. /Constructs