Question 9
Edexcel Computer Science June 2019 Paper 2GCSE9 marks
On the specification
- 1.2 Algorithms6.2 Program constructs6.3 Data types and structures
Question text
9 The ice cream kiosk has a set of freezers for storing ice cream. If a freezer malfunctions, then Margaret needs to be informed. • The perfect temperature for storing ice cream is -18°C. • A permissible temperature tolerance is plus or minus one degree Celsius. • An output message must be displayed to show the number and temperature of any freezer falling outside tolerance. • The output message for each freezer must be on a single line. • No other messages should be displayed. • A global data structure holding the temperatures is provided and must be used as part of the solution. SET freezers TO [-20, -19, -18, -17, -16, 0, 1] • The solution should work even if the number of freezers in the data structure is changed. An example output is shown. Freezer 0 is out of tolerance: -20 Freezer 4 is out of tolerance: -16 Freezer 5 is out of tolerance: 0 Freezer 6 is out of tolerance: 1 Write an algorithm to inform Margaret if any of the freezers are faulty. Use pseudocode or a programming language with which you are familiar. Please write your algorithm on pages 29, 30 and 31. You may not need all of this space for your answer. Please draw a line through any work you do not want to be marked. (9) SET freezers TO [-20, -19, -18, -17, -16, 0, 1]