Photo AI

The leisure centre uses an algorithm, based on demand in previous years, to determine peak and off peak times - Edexcel - GCSE Computer Science - Question 2 - 2021 - Paper 1

Question icon

Question 2

The-leisure-centre-uses-an-algorithm,-based-on-demand-in-previous-years,-to-determine-peak-and-off-peak-times-Edexcel-GCSE Computer Science-Question 2-2021-Paper 1.png

The leisure centre uses an algorithm, based on demand in previous years, to determine peak and off peak times. Here is the pseudocode for this algorithm.. The valu... show full transcript

Worked Solution & Example Answer:The leisure centre uses an algorithm, based on demand in previous years, to determine peak and off peak times - Edexcel - GCSE Computer Science - Question 2 - 2021 - Paper 1

Step 1

State the name of the programming construct used in line 7 of the algorithm.

96%

114 rated

Answer

Selection

Step 2

Complete the table to show the output of the algorithm for the given inputs.

99%

104 rated

Answer

InputsOutput
(month = 7)Peak rates apply
(month = 12) AND (time = 19:00)Standard rates apply
(month = 4) AND (day = 6)Peak weekend rates apply

Step 3

Construct suitable test data to produce an output stating 'Off peak rates apply':

96%

101 rated

Answer

  1. Input test data for month = 3 or 4 or 9 or 10 (1)
  2. Input test data for day <= 5 (1)
  3. Input test data for time not between 17:00 and 20:00 (1)

Example: month = 10 AND day = 4 AND time = 12:00

Join the GCSE students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

;