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

From match records to the cricket league champions.

Build the solution in a sensible order: input and validate the matches played, take every club’s name and results, re-enter any trio that does not add up, award the points into Points[], and crown the club or clubs with the highest total. Learn the reasoning before revealing the complete program.

1D + 2D arraysInput validationRe-entry loopsPoints accumulationTied winners15 marks

Learning targets

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

Lesson overview

01 · Understand

Identify the three arrays and their shared club index, and see that this program inputs every value itself: the matches played, the club names and each club’s won, drawn and lost figures.

02 · Construct

Build the two validation loops: Matches against the 22-match maximum, and each club’s trio against Matches with full re-entry until they match.

03 · Complete

Award 12 points per win and 5 per draw into Points[], then find the highest total and output every club that reaches it, with wins and points.

!

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 shared club index, the exact-match validation and the “club or clubs” wording all shape the structure of your answer.

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

The one-dimensional (1D) array Clubs[] is used to store the names of 12 cricket clubs in a local sports league.

The two-dimensional (2D) array Statistics[] is used to store, for each cricket club, the number of:

  • matches won
  • matches drawn
  • matches lost.

The 1D array Points[] is used to store the total number of points each cricket club has been awarded.

The position of any cricket club’s data is the same in all three arrays. For example, the data in index 2 of Statistics[] and index 2 of Points[] belongs to the cricket club in index 2 of Clubs[]

The variable Matches stores the number of matches played by each team. Each team plays the same number of matches.

Points are awarded for:

  • a win – 12 points
  • a draw – 5 points
  • a loss – 0 points.

Write a program that meets the following requirements:

  • allows the number of matches played to be input and stored, with a maximum of 22 matches
  • validates the number of matches played
  • allows the names of the cricket clubs to be input and stored
  • allows the number of matches won, drawn and lost to be input and stored for each team
  • validates the number of matches won, drawn or lost against the number of matches played
  • asks the user to re-enter the number of matches won, drawn or lost if the total does not match the number of matches played
  • calculates and stores the total number of points for each club
  • finds the cricket club or clubs with the highest number of points
  • outputs the name or names of the winning club or clubs, the number of wins and the total number of points awarded.

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

You do not need to declare any arrays or variables; you may 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 number of matches played into Matches and validate it against the maximum of 22 before any club data is taken.

R2

Input the 12 club names into Clubs[] and each club’s won, drawn and lost figures into Statistics[].

R3

Validate each club’s trio against Matches and make the user re-enter all three figures until they total Matches exactly.

R4

Calculate each club’s points (wins × 12 + draws × 5, losses score 0) and store it in Points[] at the shared index.

R5

Find the highest value in Points[], then output every club that reaches it with its name, number of wins and total points.

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.