Skip to content

Course home

Boolean operations in a programming language

Boolean operations in a programming language

EasyMedium
123456789101112131415161718
Question 13

An algorithm is designed to manage the irrigation of a high-yield hydroponic greenhouse based on the measured ambient temperature and soil moisture levels.

Figure 1

ambientTemp ← USERINPUT
soilMoisture ← USERINPUT
waterVolume ← 0.0
msgInhibited ← "Irrigation inhibited"
msgTooCold ← "Temperature below freezing threshold"
IF ambientTemp > 5.0 AND soilMoisture < 80.0 THEN
    IF soilMoisture < 30.0 THEN
        waterVolume ← 15.0
        OUTPUT waterVolume
    ELSE IF soilMoisture < 60.0 THEN
        waterVolume ← 8.0
        OUTPUT waterVolume
    ELSE
        OUTPUT msgInhibited
    ENDIF
ELSE
    OUTPUT msgTooCold
ENDIF

State how many possible values the result of the comparison ambientTemp > 5.0 could evaluate to in the algorithm shown in Figure 1.

[1]
Markscheme

Boolean operations in a programming language Questions

  1. GCSE
  2. /Computer Science
  3. /Boolean operations in a programming language

19 exam-style questions on AQA GCSE Computer Science Boolean operations in a programming language. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank