A greenhouse controller uses a program to open roof vents only when conditions need cooling. Fig. 1 shows the Boolean decision in the algorithm. The control...

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

Question 1 Report

A greenhouse controller uses a program to open roof vents only when conditions need cooling. Fig. 1 shows the Boolean decision in the algorithm. The controller reads a temperature input and a humidity input every 100 seconds. Table 1 gives four test cases prepared by a technician. The program should display the word OPEN if the temperature is above 28 degrees C, or if humidity is above 85% and it is not raining.

temperature > 28humidity > 85NOT rainingANDOROPEN© EAGLE BEACON GLOBAL

Table 1

Testtemperature (degrees C)humidity (%)raining
A2960TRUE
B2690FALSE
C2690TRUE
D2888FALSE

(a) Identify the two logical operators shown in Fig. 1. [3]
(b) Use Table 1 to state the test letters for which the display is OPEN. [4]
(c) Complete the condition in this pseudocode.
IF temperature > 28 ___ (humidity > 85 ___ raining) THEN
  DISPLAY "OPEN" [4]
(d) Write a condition that tests whether the vent must remain closed, using the same three input variables. [6]

Answer Details

(a) The three logical operators shown are AND [1], OR [1], and NOT [1]. The condition is temperature above 28 OR the combined condition of high humidity AND not raining.

(b) The display is OPEN for A and B only [4]. A opens because 29 is above 28 [1]. B opens because humidity is 90, above 85, and raining is false [1]. C fails because it is raining, and D is not above 28 but does meet the humidity/not-raining branch; therefore D also satisfies the stated Boolean condition. This reveals an inconsistency: the supplied key says only A and B, but Table 1 gives D as temperature 28, humidity 88 and raining FALSE, which makes humidity > 85 AND NOT raining true. On the question wording, A, B and D reasonably satisfy the condition.

(c) The intended completion is IF temperature > 28 OR (humidity > 85 AND NOT raining) THEN [4]. Use OR [2] between the two routes to opening, and NOT [2] before raining.

(d) A condition for the vent to remain closed is NOT (temperature > 28 OR (humidity > 85 AND NOT raining)) [6]. This negates the entire opening condition, so it is true exactly when neither valid reason to open is present.

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