12Easy
0/1

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]

Boolean operations in a programming language Questions

Practise AQA GCSE Computer Science Boolean operations in a programming language with exam-style questions for GCSE Computer Science. 19 questions, matched to the AQA GCSE Computer Science (8525) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.

PreviousNext

Boolean operations in a programming language Questions

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