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

From monthly litter weights to prizes and certificates.

Build the solution in a sensible order: understand the parallel arrays, input and validate each weight, sort both arrays descending in step, award the two heaviest pickers, then build the certificate list for every weight over 3 kilograms. Learn the reasoning before revealing the complete program.

1D parallel arraysInput validationDescending bubble sortTop-two selectionStrict > 3 boundary15 marks

Learning targets

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

Lesson overview

01 · Understand

Identify the two given arrays, their shared member index, the two-heaviest prize decided by the sort and the strict over-3-kilogram certificate rule.

02 · Construct

Input and validate every weight, then bubble sort PickedWeight[] and PickerName[] in parallel so every swap moves a name with its weight.

03 · Complete

Output Best in Group and Second best in Group, build PickerCertificate[] with its own counter, and report the number of certificates to print.

!

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 member index, the descending order of the sort and the strict over-three-kilogram boundary all affect the structure of your solution.

Question 12 · 15 marks
Cambridge IGCSE Computer Science · 0478/23 · Question 12

Members of a litter picking group complete a litter pick every month. Members’ names are stored in one-dimensional (1D) array PickerName[].
Each member stores the weight of the litter they have picked in another one-dimensional (1D) array PickedWeight[].
The weights are in kilograms with one decimal place, for example 8.4.
The position of each member’s data in the two arrays is the same. For example, the member stored at index 10 in PickerName[] and at index 10 in PickedWeight[] is the same.

Every month, there is a small prize awarded to the members of the group who have the two heaviest weights. Certificates are awarded to all members with a pick weight of over three kilograms.

Write a program that meets the following requirements:

  • allows the weight of members’ picks to be input and validated
  • sorts the arrays PickedWeight[] and PickerName[] in descending order of weight
  • outputs the member names and the pick weights of the members with the two heaviest picks and identifies them as “Best in Group” and “Second best in Group”
  • stores the names of all the members who will receive a certificate in the array PickerCertificate[]
  • 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 declare any arrays or variables; you may assume that this has already been done.

All inputs and outputs must contain suitable messages.

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

Before you move on

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

Mark-scheme map
R1

Input every member’s pick weight with a suitable message and validate it before the value is accepted.

R2

Sort PickedWeight[] and PickerName[] in parallel into descending order of weight, keeping each name with its weight.

R3

Output the top two names and weights with the labels “Best in Group” and “Second best in Group”.

R4

Store the name of every member with a weight over three kilograms in PickerCertificate[].

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.