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

From double-checked times to prizes and certificates.

Build the solution in a sensible order: understand the parallel arrays, input every time twice and verify the pair, sort both arrays together in ascending order of time, award First, Second and Third, then fill MemberCertificate[] with its own counter and report how many certificates to print. Learn the reasoning before revealing the complete program.

Parallel arraysInput verificationAscending sortStrict boundary < 240Building an array15 marks

Learning targets

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

Lesson overview

01 · Understand

Identify the pre-stored MemberName[], the MemberTime[] your program fills, and the MemberCertificate[] your program builds, all sharing one index until the sort moves them.

02 · Construct

Wrap each time in a REPEAT...UNTIL double-input check, then bubble-sort MemberTime[] and MemberName[] together, ascending, swapping both arrays on every exchange.

03 · Complete

Read the podium straight off positions 1 to 3 as First, Second and Third, pack the under-240 names into MemberCertificate[] with a counter of its own, and output the certificate count in a message.

!

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 parallel-array swap, the direction of the sort, the strict under-240 boundary and the certificate array’s own counter all decide whether your answer earns the marks.

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

A running club has 200 members who compete in a 1-kilometre running competition every month.
Members’ names are stored in the one-dimensional (1D) array MemberName[]
Each member’s time, in seconds, for the 1-kilometre run will be stored in another one-dimensional (1D) array MemberTime[]
The position of each member’s data in the two arrays is the same. For example, the member stored at index 10 in MemberName[] and at index 10 in MemberTime[] is the same.

The running club awards a small prize to the members who have the top three times. The club also awards certificates to all members with a time under 240 seconds.

Write a program that meets the following requirements:

  • allows members’ times to be input twice and verifies that the inputs match
  • sorts the arrays MemberTime[] and MemberName[] in ascending order of time
  • outputs the member names and times of the members with the top three times and identifies them as First, Second and Third
  • stores the names of all the members who will receive a certificate in the array MemberCertificate[]
  • outputs a message stating the number of certificates to be printed.

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

You do not need to initialise the data in the array MemberName[]

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 every member’s time twice and repeat until the two entries match, storing only verified times into MemberTime[].

R2

Sort MemberTime[] and MemberName[] together in ascending order of time, swapping both arrays on every exchange.

R3

Output the names and times at positions 1 to 3 after the sort, identified as First, Second and Third.

R4

Store the names of every member with a time under 240 seconds in MemberCertificate[], packed tight with its own counter.

R5

Output a message stating the number of certificates to be printed.

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.