Skip to content

Course home

Algorithms

Algorithms

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
Question 44

An algorithm is used to determine the admission prices for a local museum.

The pseudocode for this algorithm is shown below.

  • The values for month are 1 = January, 2 = February ... 12 = December.
  • The values for 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.

InputOutput displayed
monthcategory
122
73
41
[3]
Markscheme

Algorithms Questions

  1. GCSE
  2. /Computer Science
  3. /Algorithms

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.

Question bank