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.
Table 1
| Test | temperature (degrees C) | humidity (%) | raining |
|---|---|---|---|
| A | 29 | 60 | TRUE |
| B | 26 | 90 | FALSE |
| C | 26 | 90 | TRUE |
| D | 28 | 88 | FALSE |
(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]
(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.
Everything you need to excel in your exams