HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /A heater uses two stored values. It switches on when the reading is below 18 °C and it is off, and…
MediumComputer ScienceHigh School (9–10)Computer Science › Automated and Emerging TechnologiesNumericalIGCSE

A heater uses two stored values. It switches on when the reading is below 18 °C and it is off, and…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

A heater uses two stored values. It switches on when the reading is below 18 ∘C18\ ^\circ\text{C}18 ∘C and it is off, and it switches off when the reading is above 22 ∘C22\ ^\circ\text{C}22 ∘C and it is on. At the start the heater is off. Ten readings, in ∘C^\circ\text{C}∘C, arrive in this order:

19, 17.5, 18.5, 21, 22.5, 20, 17, 19, 23 and 18.

How many times does the heater switch on? After how many of the ten readings is the heater on? Is it on or off at the end?

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

A control loop reads the sensor, compares the reading with the stored values, acts, and repeats for as long as the system runs. Feedback means that what the actuator does changes the next sensor reading. With two stored values, the actuator comes on below the low value and goes off above the high value; between them nothing changes.

The worked solution

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Plan. Trace the readings one at a time. Only a reading below 181818 can switch the heater on, and only a reading above 222222 can switch it off.

Step 1. The trace.

  • 191919: between the values, so it stays off.
  • 17.517.517.5: below 181818, so it switches on (first time).
  • 18.518.518.5 and 212121: between, so it stays on.
  • 22.522.522.5: above 222222, so it switches off.
  • 202020: stays off.
  • 171717: below 181818, so it switches on (second time).
  • 191919: stays on.
  • 232323: above 222222, so it switches off.
  • 181818: not below 181818, so it stays off.

Step 2. Count. The heater switched on 222 times. It was on after the 2nd, 3rd, 4th, 7th and 8th readings, which is 555 readings.

Answer: 222 times, on after 555 readings, and off at the end.

Watch out. The last reading, 181818, is equal to the low value, not below it.

Log in to save this for later
← All Problems
← A school car park has a barrier at its entrance and a sign that shows the number of free spaces…An office is at 26 °C when the air conditioning leaves it… →
More onComputer Science › Automated and Emerging Technologies

Discussion (0)

Log in to join the discussion.

Loading…

More on this topic

  1. A filter calls an email unwanted when its score is greater than its dividing line T…Hard
  2. A bank wants software to decide which card payments might be fraud…Hard
  3. A learning filter is given eight emails that users have labelled…Medium
  4. An email service has a filter that moves unwanted messages into a separate folder…Medium
  5. A health centre in a remote area uses an expert system to help a nurse decide whether a patient…Hard
All problems on this topic →