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

From blank arrays to the class’s most and least popular option.

Build the solution in a sensible order: initialise the three arrays, validate the option and voter counts, take each option string, display the list to every voter and validate each vote, tally VoteCount[], then crown the most and least popular options. Learn the reasoning before revealing the complete program.

1D arraysValidation loopsIndex tallyingMax + min trackingSuitable messages15 marks

Learning targets

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

Lesson overview

01 · Understand

Identify the three 1D arrays, the 2–12 option range, the 2–1000 voter range, and why VoteCount[] is indexed by option number.

02 · Construct

Validate both counts with re-entry loops, store every option string, and display the option list to each voter before validating and storing their vote.

03 · Complete

Tally the votes into VoteCount[], track the most and least popular options in one scan, and output both with their vote counts.

!

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 two validated ranges, the index-based tally and the assumed declarations all shape the structure of your solution.

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

A program is required to enable voting in class surveys, for example to find the most popular smartphone.

The one-dimensional (1D) array Options[] is used to store between 2 and 12 options on which users can vote.

The one-dimensional (1D) array Votes[] is used to store the votes of between 2 and 1000 users.

The one-dimensional (1D) array VoteCount[] is used to store the number of votes for each of the options. The array index represents the option number.

Write a program for the following requirements:

  • Initialise all the arrays before they are used.
  • Input and validate the number of options and the number of voters.
  • Input each of the required options and store them in the array Options[]
  • Display the list of options for each voter and allow each voter to input their preferred option. Validate this input and store it in the array Votes[]
  • Once all the votes have been input, count the number of voters who chose each option and find the most and least popular options.
  • Output the most and least popular options as well as the number of voters who selected each of these options.

The program does not need to identify if two or more options are the equal most or least popular.

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

Do not declare arrays, variables or constants for this algorithm; assume this has been done.

Initialisation must be carried out as appropriate.

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

Initialise Options[], Votes[] and VoteCount[] before any of them is used.

R2

Input and validate the number of options (2–12) and the number of voters (2–1000), re-entering any invalid value.

R3

Input each option into Options[], then display the list to every voter, validate the preferred option number and store it in Votes[].

R4

Once all the votes are in, count the voters who chose each option into VoteCount[] and find the most and least popular options.

R5

Output the most and least popular options with the number of voters who selected each, using suitable messages throughout.

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.