Question 1 Report
Fig. 1 shows a robot greenhouse algorithm. It checks the soil moisture number every hour and decides whether to open a water valve. Table 1 gives one morning of sensor data. The cap on the valid sensor range is 100, and the program displays an error message for impossible values. When a valid value is below 35, the valve is opened. All other valid values keep the valve closed. A technician wants to test that each path in the pseudocode gives the correct output.
| Time | Moisture reading |
|---|---|
| 08:00 | 34 |
| 09:00 | 35 |
| 10:00 | 104 |
(a) Identify the output at 08:00. [1]
(b) State the output at 09:00. [1]
(c) Write the output at 10:00. [1]
(d) Give one test value that checks the lower boundary of the valid range. [1]
(a) At 08:00, the reading is 34. It is valid and is below 35, so the output is open valve. [1]
(b) At 09:00, 35 is valid but is not below 35. The output is close valve. [1]
(c) At 10:00, 104 is outside the valid range 0 to 100, so the output is display error. [1] The moisture decision should not be used for impossible sensor data.
(d) A lower-boundary test value is 0. [1] It checks that the smallest valid reading is accepted.
Everything you need to excel in your exams