Skip to content

Course home

Boolean logic

Boolean logic

EasyMedium
123456789101112131415161718192021222324
Question 12

An automated greenhouse irrigation system uses an algorithm, represented in pseudo-code, to determine the misting duration for various crops based on humidity levels.

Figure 1

humidityLevel ← USERINPUT
cropType ← USERINPUT
mistDuration ← 0
errCodeA ← "Sensor Error"
errCodeB ← "Unsupported Crop"
IF humidityLevel <= 65.5 AND cropType != "None" THEN
    IF cropType == "Fern" THEN
        mistDuration ← 120
        OUTPUT mistDuration
    ELSE IF cropType == "Succulent" THEN
        mistDuration ← 15
        OUTPUT mistDuration
    ELSE
        OUTPUT errCodeB
    ENDIF
ELSE
    OUTPUT errCodeA
ENDIF

State how many possible values the result of the comparison humidityLevel <= 65.5 could have in the algorithm shown in Figure 1.

[1]
Markscheme

Boolean logic Questions

  1. GCSE
  2. /Computer Science
  3. /Boolean logic

30 exam-style questions on AQA GCSE Computer Science Boolean logic. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank