CAMBRIDGE IGCSE COMPUTER SCIENCE
Summer 2026 · Paper 21 · Question 12 · 15 marks
← 0478 CS Hub Paper 21 · Summer 2026 0478 / Paper 2 Question 12 15 MARKS
15-mark question lab · start here

From daily sunshine minutes to a month-wide report.

Build the solution in a sensible order: decode the six requirements, plan the variables, initialise the totals, test the leap year and update February, read the month, record and validate each day’s sunshine, then convert to hours and minutes and report. Learn the reasoning before revealing the complete program.

1D arraysLeap-year selectionREPEAT … UNTIL validationTotallingDIV/MOD conversion15 marks

Learning targets

By the end, you should be able to explain the algorithm before writing it.

Lesson overview

01 · Understand

Identify the two given arrays, the question’s own leap-year definition and the six requirements hidden in the bullet list.

02 · Construct

Build the program in order: leap-year selection that updates MonthDays[2], a CASE OF month lookup, and a validated REPEAT … UNTIL loop that stores, totals and tracks each day’s sunshine.

03 · Complete

Convert the total and the highest daily value to hours and minutes with DIV and MOD, and output the year, month, total and highest with suitable messages.

!

How Cambridge awards the marks: the mark scheme gives AO2 a maximum of 9 marks and AO3 a maximum of 6 marks. It lists requirements R1–R5, but does not assign a separate fixed mark total to each R requirement. The stage-to-mark links in this guide show alignment, not invented stage marks.

Source question

Read the whole question first

Do not begin coding after the first paragraph. The leap-year definition, the two given arrays and the “hours and minutes” outputs all affect the structure of your solution.

Question 12 · 15 marks
Cambridge IGCSE Computer Science · 0478/21 · Question 12

A weather monitoring station records the number of minutes of sunshine for each day of a month.

The one-dimensional (1D) array Sunshine[] 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 MonthDays[] 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 of days in February as appropriate
  • allows a user to input the name of one of the first three months of the year: January, February or March
  • allows a user to input the number of minutes of sunshine for each day of the month and validates the input
  • 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.

Before you move on

These are the five required techniques identified by the Cambridge mark scheme.

Mark-scheme map
R1

Input the year, test MOD(Year, 4) = 0 and update MonthDays[2] to 29 or 28 — selection and input.

R1

Input the month name, convert it with LCASE and use CASE OF to set Days from MonthDays[] — selection.

R2

Input each day’s sunshine with REPEAT … UNTIL validation in the range 0 to 1440, store it in Sunshine[] and total the minutes — validation, iteration, totalling.

R2

Track the highest daily sunshine with a strictly-greater maximum test — selection, finding max.

R3

Convert the total and the highest daily to hours and minutes with DIV and MOD, and output the year, month, total and highest — output.

Use the tabs along the top to work through the seven stages. The complete solution is kept in its own tab, and the interactive visualisation is the final tab.