Skip to content

Course home

Boolean operations in a programming language

Boolean operations in a programming language

EasyMedium
123456789101112131415161718
Question 11

A smart lighting controller uses the following algorithm to adjust brightness levels based on the room mode entered by a user:

Figure 1

1      mode ← USERINPUT
2      IF mode = 'sleep' THEN
3          brightness ← 10
4      ELSE IF mode = 'reading' THEN
5          brightness ← 80
6      ELSE IF mode = 'party' THEN
7          color ← 'purple'
8      ELSE
9          OUTPUT 'mode not supported'
10     ENDIF
11     FOR count ← 1 TO brightness
12         IF count < 50 THEN
13             FADE_LED('warm_white')
14         ELSE
15             FADE_LED('cool_white')
16         ENDIF
17     ENDFOR

State how many possible values the result of the comparison mode = 'reading' could have.

[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