A robotics club writes a program to move a greenhouse inspection robot along a bench. Fig. 1 is a flowchart for one scan. The robot reads a moisture value f...

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

Question 1 Report

A robotics club writes a program to move a greenhouse inspection robot along a bench. Fig. 1 is a flowchart for one scan. The robot reads a moisture value from each plant pot. If the value is below 35, it displays the word WATER; otherwise it displays OK. After either display, the variable pot increases by 1. The robot must stop after it has processed 6 pots. A student has used the wrong comparison in the loop decision.

INPUT moisturemoisture < 35?DISPLAY WATERDISPLAY OKpot = pot + 1pot < 6?© EAGLE BEACON GLOBAL

Fig. 1: greenhouse robot flowchart

(a) Identify the construct represented by the paths that lead to DISPLAY WATER and DISPLAY OK. [1]
(b) Write the display for moisture inputs 34, 35 and 61. [3]
(c) Complete the final decision so that exactly six pots are processed, and write a suitable initial value for pot. [4]

Answer Details

(a) The two alternative paths chosen by the result of moisture < 35? form a selection, also called an IF...ELSE construct. Only one of the two display commands is carried out. [1]

(b) The comparison is strictly below 35, so 35 itself does not satisfy it.

  • For 34, 34 < 35 is true, so display WATER. [1]
  • For 35, 35 < 35 is false, so display OK. [1]
  • For 61, 61 < 35 is false, so display OK. [1]

(c) If pot starts at 1 and is increased after each pot, the sixth pot is processed when pot = 6. The loop must therefore continue while pot <= 6; equivalently, it may use pot < 7. [2] A suitable initial value is pot = 1. [2] This avoids stopping after only five pots, which would happen with pot < 6.

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