Question 1 Report
In the final stage of a greenhouse program, a heater is switched on if the soil temperature is too low. The sensor value is stored in soilTemp in degrees C. The grower wants the heater on at 8 degrees C and at every value below 8 degrees C. A trainee writes this condition:
IF soilTemp < 8 THEN
heaterOn = TRUE
ENDIF
(a) Explain the result of the relational test when soilTemp is 7.5. [1]
(b) When soilTemp is exactly 8, explain why the heater remains off. [1]
(c) When the grower's requirement is implemented, write the condition that should be used. [1]
(a) When soilTemp is 7.5, the test soilTemp < 8 is true because 7.5 is less than 8. [1]
(b) At exactly 8, the test is false because 8 is not less than 8. Therefore the displayed code does not switch the heater on. [1]
(c) The requirement includes 8 and all lower temperatures, so the correct condition is soilTemp <= 8. [1]
Everything you need to excel in your exams