Skip to content

Course home

Boolean operations in a programming language

Boolean operations in a programming language

EasyMedium
123456789101112131415161718
Question 5

An automated hydroponic greenhouse dosing system uses the following algorithm to adjust nutrient concentration levels based on the growth stage entered by the operator:

1      stage ← USERINPUT
2      IF stage = 'seedling' THEN
3          dosage_ml ← 5
4      ELSE IF stage = 'vegetative' THEN
5          dosage_ml ← 25
6      ELSE IF stage = 'flowering' THEN
7          supplement ← 'potassium'
8      ELSE
9          OUTPUT 'invalid growth stage'
10     ENDIF
11     FOR pulse ← 1 TO dosage_ml
12         IF pulse < 15 THEN
13             INJECT_PUMP('A')
14         ELSE
15             INJECT_PUMP('B')
16         ENDIF
17     ENDFOR

State the number of possible values that the result of the boolean expression stage = 'vegetative' can take.

[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