Computer Science · May / June 2026 · Paper 21 · Question 12
0478
As printed in the paper
The question as text
A weather monitoring station records the number of minutes of sunshine for each day of a month. The one-dimensional (1D) array ª£À¤¦ is used to store the number of minutes of sunshine for each day. The index of the array represents the day. The one-dimensional (1D) array ¨}Σ¤¦ contains the number of days in each month. The index of the array represents the month. In this array, 28 is stored in index 2 for the month of February. However, there are 29 days in February in a leap year. In this program, a leap year is a year that divides by 4 with no remainder. For example, 2026 is not a leap year but 2028 will be a leap year. Write a program that meets the following requirements: • allows the user to input a year, calculates whether it is a leap year and updates the number o • allows a user to input the name of one of the first three months of the year: January, February • allows a user to input the number of minutes of sunshine for each day of the month and valid • calculates the total amount of sunshine for the month in hours and minutes • finds the highest amount of daily sunshine for the month • outputs the: Ï year Ï month Ï total amount of sunshine for the month in hours and minutes Ï the highest amount of daily sunshine for the month. You must use pseudocode or program code and add comments to explain how your code works. Do not declare any arrays or variables; assume that this has already been done. All inputs and outputs must contain suitable messages.
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
Use the tables for AO2 and AO3 below to award a mark in a suitable band using a best fit approach Then add up the total.
Marks are available for:
Data Structures required names shown underlined must be used as given in the scenario arrays or lists Sunshine, MonthDays
(Year and Month may be seen but no requirement to store)
Requirements (techniques)
R1 input year, calculates if leap year, updates MonthDays[] if appropriate, input month name (selection and input)
R2 inputs and validates the daily minutes for the month, calculates the total minutes and finds the highest daily sunshine (validation, iteration, selection, totalling)
R3 outputs the year, month, highest daily sunshine for the month, calculate and output the total sunshine in hours and minutes (output)
Example 15-mark answer in pseudocode.
// programming techniques of iteration, selection, totalling, and output are used
Hours ← 0
Minutes ← 0
MaxHours ← 0
MaxMinutes ← 0
Max ← 0
Days ← 0
Total ← 0
// R1
/////////////////////////////////////////////////////////////////////////// OUTPUT "Please enter a year"
INPUT Year
IF MOD(Year, 4) = 0 // updating array if leap year
THEN
MonthDays[2] = 29
ELSE
MonthDays[2] = 28
ENDIF
// entering a month and assigning the
// number of days to variable
OUTPUT "Please enter a month"
INPUT Month
Month1 ← LCASE(Month) // converting to lowercase for use in case // statement – keeping original for output
// R2
///////////////////////////////////////////////////////////////////////// CASE OF Month1
"january" : Days ← MonthDays[1]
"february" : Days ← MonthDays[2]
"march" : Days ← MonthDays[3]
ENDCASE
FOR Count ← 1 to Days // inputting sunshine for each day and validating REPEAT // in a valid range
OUTPUT "Please enter sunshine for day in minutes ", Count
INPUT Sun
UNTIL Sun >= 0 AND Sun <= 1440
Sunshine[Count] ← Sun // storing in array
Total ← Total + Sun // totalling sunshine
IF Sun > Max
THEN
Max ← Sun // updating highest daily
ENDIF
NEXT Count
// R3
///////////////////////////////////////////////////////////////////////// Hours ← DIV(Total, 60) // converting to hours and minutes for total and Minutes ← MOD(Total, 60) // daily
// MaxHours ← DIV(Max, 60) // if learner converts highest daily
// MaxMinutes ← MOD(Max, 60)
// outputting results
OUTPUT "The sunshine for ", Month, " in the year ", Year
OUTPUT "Total sunshine was ", Hours, " hours and ", Minutes, " minutes" OUTPUT "The highest daily sunshine was ", MaxHours, " hours and ",
MaxMinutes, " minutes"
Marking Instructions in italics
AO2: Apply knowledge and understanding of the principles and concepts of computer science to a given context, including the analysis and design of computational or
programming problems
1–3
4–6
7–9
0
No creditable
At least one programming
Some programming
The range of
response.
technique has been used.
techniques used are
programming techniques Any use of selection,
appropriate to the
used is appropriate to the iteration, counting,
problem.
problem.
totalling, input and output.
More than one technique
All criteria stated for the seen applied to the
scenario have been scenario, check the list of
covered by the use of techniques needed.
appropriate programming techniques, check the list of techniques needed. Some data has been
Some of the data
The data structures stored but not
structures chosen are
chosen are appropriate appropriately.
appropriate and store
and store all the data Any use of variables or
some of the data
required.
arrays or other language
required.
The data structures used dependent data
More than one data
store all the data required structures e.g. Python
structure used to store
by the scenario. lists.
data required by the
scenario.
Marking Instructions in italics
AO3: Provide solutions to problems by:
1–2
3–4
5–6 0
No creditable
Program seen without
Program seen with some
The program has been response.
relevant comments.
relevant comment(s).
fully commented. Some identifier names
The majority of identifiers
Suitable identifiers with used are appropriate.
used are appropriately
names meaningful to their Some of the data
named.
purpose have been used structures used have
Most of the data
throughout.
meaningful names.
structures used have
All of the data structures meaningful names.
used have meaningful names.
The solution is illogical.
The solution contains
The program is in a parts that may be
logical order.
illogical.
The solution is inaccurate
The solution contains
The solution is accurate. in many places.
parts that are inaccurate.
Solution logically Solution contains few
Solution contains lines of
performs all the tasks lines of code with errors
code with some errors
given in the scenario. that attempt to perform a
that logically perform
Ignore minor syntax task given in the
tasks given in the
errors.
scenario.
scenario. Ignore minor
syntax errors.
0
1-2
3-4
5-6
The solution attempts at
The solution meets most
The solution meets all the least one of the
of the requirements.
requirements given in the requirements.
Solution contains lines of
question.
Solution contains lines of
code that perform most
Solution performs all the code that attempt at least
tasks given in the
tasks given in the one task given in the
scenario.
scenario.
scenario.
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

