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 mornin...

Assessment: Computer Science 4CP0 | Paper 2 Mock 01 | Written Paper 2 Subject: Computer Science - 4CP0

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.

TimeMoisture reading
08:0034
09:0035
10:00104
Fig. 1: moisture decision algorithm0 to 100?yesbelow 35?yes: open valveno: display errorno: close valve

(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]

Answer Details

(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.

Download The App On Google Playstore

Everything you need to excel in your exams

Green Bridge CBT Mobile App
Personalized AI Learning Chat Assistant
200,000+ Exam Questions Across IGCSE, JAMB, WAEC & NECO
Over 3,900 Lesson Notes
Offline Support - Learn Anytime, Anywhere
Green Bridge Timetable
Literature Summaries & Potential Questions
Track Your Performance & Progress
In-depth Explanations for Comprehensive Learning