A chemical mixing chamber has two reagent feed valves: an acid feed valve and an alkali feed valve. To prevent a dangerous runaway neutralization reaction, both valves must never be open at the same time.
The control system runs the following algorithm:
1 WHILE (systemActive = True) DO
2
3 RECEIVE acidRequest FROM SENSOR_ACID
4 IF (acidRequest = True) THEN
5 SET acidValve TO "Open"
6 END IF
7
8 RECEIVE alkaliRequest FROM SENSOR_ALKALI
9 IF (alkaliRequest = True) THEN
10 SET alkaliValve TO "Open"
11 END IF
12
13 IF (acidRequest = False) THEN
14 SET acidValve TO "Closed"
15 END IF
16
17 IF (alkaliRequest = False) THEN
18 SET alkaliValve TO "Closed"
19 END IF
20
21 END WHILE
State one condition allowed by the algorithm that does not meet the safety requirements for the mixing chamber.
159 exam-style questions on Edexcel GCSE Computer Science Algorithms, covering Constructs for solving problems, Variables, constants and data structures, Arithmetic, relational and logical operators, Tracing algorithm output with trace tables, Types of error and correcting logic errors, Standard algorithms (sorts and searches), and Evaluating algorithm fitness and efficiency. Each one has a worked solution and a mark scheme showing where the marks go.