Question 1 Report
The diagram shows a robot used in a greenhouse to water seedlings. Its program receives a plant-zone code, checks a moisture sensor and opens a valve only when watering is needed. A technician is planning the program as separate subroutines, so that the sensor code can later be used in another greenhouse.
(a) Identify two outputs from the greenhouse control program shown in Fig. 1. [2]
(b) Write the name of one subroutine that could obtain and return the moisture reading. [2]
(c) Give two items of real-world detail that can be abstracted away when deciding whether a zone needs water. [2]
(d) Use the following rule to write the condition that opens the valve: open the valve when moisture is less than 35. [2]
(a) The two outputs are the water valve and the status display. Outputs are devices the program controls or sends information to. [2]
(b) A suitable reusable subroutine name is readMoisture. getMoistureLevel or checkMoisture would also be valid because each describes obtaining the sensor reading. [2]
(c) Abstraction keeps only information relevant to the watering decision. The colour of the pot and plant height can be omitted because neither determines whether the moisture reading is below the threshold. [2]
(d) The required condition is:
moisture < 35
This is true only when the sensor reading is below 35, so it opens the valve at the specified point. [2]
Everything you need to excel in your exams