CAMBRIDGE IGCSE COMPUTER SCIENCE
February/March 2024 · Paper 22 · Question 11 · 15 marks
← 0478 CS Hub Paper 22 · Feb/Mar 2024 0478 / Paper 2 Question 11 15 MARKS
15-mark question lab · start here

From daily screen minutes to a class screen-time report.

Build the solution in a sensible order: understand which data is given and which is input, plan the two loops, initialise the trackers, let every student enter their week, total the minutes and count the days over 300, convert each total to hours and minutes, then report the class average and the lowest-week student. Learn the reasoning before revealing the complete program.

2D array inputNested loopsStrict boundary testDIV and MODMinimum tracking15 marks

Learning targets

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

Lesson overview

01 · Understand

Identify the two arrays, their shared student index, and why ScreenTime[] is filled by input rather than supplied data.

02 · Construct

Use nested loops to input each student's seven daily minutes, total the week and count the days with strictly more than 300 minutes.

03 · Complete

Convert every weekly total to hours and minutes with DIV and MOD, calculate the class average, and output the student with the lowest weekly screen time.

!

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 input requirement, the strictly-more-than-300 boundary, the hours-and-minutes conversion and the lowest-week tracker all shape the structure of your solution.

Question 11 · 15 marks
Cambridge IGCSE Computer Science · 0478/22 · Question 11

Students in a class are recording the amount of time in minutes spent in front of a screen for each day of the week.

The one-dimensional (1D) array StudentName[] contains the names of the students in the class. The two-dimensional (2D) array ScreenTime[] is used to input the number of minutes on each day spent in front of a screen.

The position of each student’s data in the two arrays is the same. For example, the student stored at index 10 in StudentName[] and ScreenTime[] is the same.

The variable ClassSize contains the number of students in the class.

Write a program that meets these requirements:

  • allows all the students to enter their daily minutes of screen times for the past week
  • calculates the total number of minutes of screen time for each student in the week
  • counts, for each student, the number of days with more than 300 minutes of screen time
  • calculates the average weekly minutes of screen time for the whole class
  • finds the student with the lowest weekly minutes of screen time
  • outputs for each student:
    • name
    • total week’s screen time in hours and minutes
    • number of days with more than 300 minutes of screen time
  • outputs the average weekly minutes of screen time for the whole class
  • outputs the name of the student with the lowest weekly screen time.

You must use pseudocode or program code and add comments to explain how your code works.

All inputs and outputs must contain suitable messages.

Assume that the array StudentName[] and the variable ClassSize already contain the required data.

You do not need to declare any arrays or variables; you may assume that this has already been done.

Before you move on

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

Mark-scheme map
R1

Allow every student to input their daily minutes for the past week, using nested iteration and suitable messages.

R2

Total each student's minutes for the week and convert the total to hours and minutes with DIV and MOD.

R3

Count, for each student, the days with more than 300 minutes, testing strictly > 300.

R4

Output each student's name, hours-and-minutes total and high-day count, then the class average weekly minutes.

R5

Track the student with the lowest weekly minutes across the class and output that student's name.

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.