Skip to main content
O-LevelComputer ScienceData Representation2210/21 · May/June 2024 · Q1015 Marks

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.

  1. 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.[15]

Mark scheme

Marking points from the official mark scheme (May/June 2024). The mark or mark type is shown in brackets.

  1. [15] Data structures required: The names underlined must match those given in the scenario: Arrays or lists Clubs[], Statistics[], Points[], TieIndex[] Variables Matches, Won, Drawn, Lost, Counter, Maximum, TieCheck, OutLoop, Max, Count Requirements (techniques): R1 Input and store number of matches, cricket club names, number of matches won, drawn and lost. Validation of number of matches played and matches won, lost and drawn against number of matches played (with prompts, iteration, storing data in variables, validation, 1D and 2D arrays). R2 Calculate and store the number of points for each cricket club. Finding the index of the array with the highest score / highest score (calculation, finding the maximum, iteration). R3 Identifying cricket clubs with highest number of points and whether there is a tie for the top position. Output with appropriate messages (iteration, selection and output). Example 15-mark answer in pseudocode // meaningful identifiers and appropriate data structures // similar variables grouped to save space as in HL languages DECLARE Clubs : ARRAY[1:12] OF STRING DECLARE Statistics : ARRAY[1:12, 1:3] OF INTEGER DECLARE Points : ARRAY[1 : 12] OF INTEGER DECLARE TieIndex : ARRAY [1 : 12] OF INTEGER DECLARE Matches, Won, Drawn, Lost : INTEGER DECLARE Counter, Maximum, TieCheck, OutLoop : INTEGER DECLARE Max, Count : INTEGER // input number of matches REPEAT OUTPUT "How many matches have been played (Maximum 22)? " INPUT Matches UNTIL Matches <= 22 // input of data as a single loop multiple loops for data entry // is also acceptable. FOR Counter ← 1 TO 12 OUTPUT "Enter the name of the cricket club" INPUT Clubs [Counter] // input of match results with validation REPEAT OUTPUT "Enter the number of matches won, drawn and lost for ", Clubs [Counter] INPUT Won, Drawn, Lost IF Won + Drawn + Lost <> Matches THEN OUTPUT "Your inputs must total ", Matches, " please try again" ENDIF UNTIL Matches = Won + Drawn + Lost Statistics[Counter, 1] ← Won Statistics[Counter, 2] ← Drawn Statistics[Counter, 3] ← Lost // calculating and storing points Points[Counter] ← Statistics[Counter, 1] * 12 + Statistics[Counter, 2] * 5 NEXT Counter // finding the highest points Max ← -100 FOR Maximum ← 1 TO 12 IF Points[Maximum] > Max THEN Max ← Points[Maximum] ENDIF NEXT Maximum // finding the winner(s) Count ← 0 FOR TieCheck ← 1 TO 12 IF Points[TieCheck] = Max THEN Count ← Count + 1 TieIndex[Count] ← TieCheck ENDIF Next TieCheck // outputting the results FOR OutLoop ← 1 TO Count OUTPUT "Winning Club(s): ", Clubs[TieIndex[OutLoop]] OUTPUT "Number of wins: ", Statistics[TieIndex[OutLoop], 1] Next OutLoop OUTPUT "Winning Points: ", Max

Write your answer and get it marked

On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.

Sign up free →

About this question

Topic
Data Representation, O-Level Computer Science (syllabus 2210). Structured question, 15 marks.
Source
O-Level Computer Science, May/June 2024 Paper 2 Variant 1, question 10.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep