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

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

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.

Control programzone inputMoisture sensorWater valveStatus display© EAGLE BEACON GLOBAL

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

Answer Details

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

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