A chemical inventory system routes hazardous substances to different storage zones based on the first character of their safety registration code.
Below is the pseudo-code for the algorithm used to determine the storage zone.
1 IF (code[0] >= "D" AND code[0] <= "K") THEN
2 SEND "Zone Green" TO DISPLAY
3 ELSE
4 IF (code[0] >= "L" AND code[0] <= "S") THEN
5 SEND "Zone Yellow" TO DISPLAY
6 ELSE
7 IF (code[0] >= "T" AND code[0] <= "Y") THEN
8 SEND "Zone Red" TO DISPLAY
9 ELSE
10 SEND "Specialist Containment" TO DISPLAY
11 END IF
12 END IF
13 END IF
Complete the table below to show the output of the algorithm for the given inputs.
| Safety Registration Code | Storage Zone displayed |
|---|---|
| LE-5021 | |
| WA-8043 | |
| 3B-1192 |
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.