An algorithm is used to determine the admission prices for a local museum.
The pseudocode for this algorithm is shown below.
month are 1 = January, 2 = February ... 12 = December.category represent visitor types: 1 = Child, 2 = Student, 3 = Standard Adult.1 IF (month = 12) THEN
2 SEND ("Closed for maintenance") TO DISPLAY
3 ELSE
4 IF (month >= 6) AND (month <= 8) THEN
5 IF (category = 1) OR (category = 2) THEN
6 SEND ("£5.00") TO DISPLAY
7 ELSE
8 IF (category = 3) THEN
9 SEND ("£12.00") TO DISPLAY
10 ELSE
11 SEND ("High season category error") TO DISPLAY
12 END IF
13 END IF
14 ELSE
15 IF (month >= 1) AND (month <= 11) THEN
16 IF (category = 1) OR (category = 2) THEN
17 SEND ("£3.00") TO DISPLAY
18 ELSE
19 IF (category = 3) THEN
20 SEND ("£8.00") TO DISPLAY
21 ELSE
22 SEND ("Low season category error") TO DISPLAY
23 END IF
24 END IF
25 ELSE
26 SEND ("Month error") TO DISPLAY
27 END IF
28 END IF
29 END IF
Complete the table to show the output of the pseudocode algorithm based on the given inputs.
| Input | Output displayed | |
|---|---|---|
| month | category | |
| 12 | 2 | |
| 7 | 3 | |
| 4 | 1 |
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.