Computer Science · Oct / Nov 2024 · Paper 21 · Question 11
0478
As printed in the paper
The question as text
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 ¶¾Àñ¾°¬À¾ Each member’s time, in seconds, for the 1-kilometre run will be stored in another one-dimensional (1D) array ¶¾Àñ¾°ÆÀ¾ The position of each member’s data in the two arrays is the same. For example, the member stored at index 10 in ¶¾Àñ¾°¬À¾ and at index 10 in ¶¾Àñ¾°ÆÀ¾ 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 ¶¾Àñ¾°ÆÀ¾ and ¶¾Àñ¾°¬À¾ 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 ¶¾Àñ¾° ¾°¹ÆòÆÔ¬¹¾ • 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 ¶¾Àñ¾°¬À¾ 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.
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
Data Structures required names shown underlined must be used as given in the scenario.
1D Array or list MemberName[], MemberTime[], MemberCertificate[], Position[]
Variables Index, Last, ClubSize, TempTime, TempName, Swap, Count
Requirements (techniques)
R1 Input and verify the members times (input and iteration)
R2 sort the MemberName[] and MemberTime[] arrays in ascending order of time and outputs the top three members and their times (nested iteration, sorting, selection and output)
R3 Storing the members names who will receive a certificate and outputting the number of certificates (iteration, selection, counting and output)
Example 15-mark answer in pseudocode
CONSTANT ClubSize = 200 // setting the number of members in the club
DECLARE Array Position[1:3} STRING
DECLARE Position : ARRAY[1:3] OF STRING
Position[1] ← "First"
Position[2] ← "Second"
Position[3] ← "Third"
FOR Index ← 1 TO ClubSize // 200
REPEAT
PRINT "Please enter the time for ", MemberName[Index]
INPUT Time1
PRINT “Please re-enter the time”
INPUT Time2
IF Time1 <> Time2
THEN
PRINT "Incorrect input, the times should be the same, please re-enter" ENDIF
UNTIL Time1 = Time2
MemberTime[Index] ← Time1
NEXT Index
Last ←ClubSize
REPEAT
Swap ← FALSE
FOR Index ← 1 TO ClubSize - 1
IF MemberTime[Index] > MemberTime[Index + 1]
THEN
TempTime ← MemberTime[Index]
MemberTime[Index] ← MemberTime[Index + 1]
MemberTime[Index + 1] ← TempTime
TempName ← MemberName[Index]
MemberName[Index] ← MemberName[Index + 1]
MemberName[Index + 1] ← TempName
Swap ← TRUE
ENDIF
NEXT Index
Last ← Last - 1
UNTIL NOT Swap or Last = 1
FOR Index ← 1 TO 3
OUTPUT Position[Index], MemberName[Index], " with a time of ", MemberTime[Index] NEXT Index
Count ← 0
FOR Index ← 1 TO ClubSize // 200
IF MemberTime[Index] < 240
THEN
Count ← Count + 1
MemberCertificate[Count] ← MemberName[Index]
ENDIF
NEXT Index
OUTPUT "Number of certificates to be printed is ", Count
AO2: Apply knowledge and understanding of the principles and concepts of computer science to a given context, including the analysis and design of computational or programming problems
1–3
4–6
7–9 0
No creditable response.
At least one programming technique
Some programming techniques used
The range of programming has been used.
are appropriate to the problem.
techniques used is appropriate to the Any use of selection, iteration,
More than one technique seen
problem.
counting, totalling, input and output.
applied to the scenario, check list of
All criteria stated for the scenario techniques needed.
have been covered by the use of appropriate programming techniques, check list of techniques needed.
Some data has been stored but not
Some of the data structures chosen
The data structures chosen are appropriately.
are appropriate and store some of
appropriate and store all the data Any use of variables or arrays or
the data required.
required.
other language dependent data
More than one data structure used
The data structures used store all structures e.g. Python lists.
to store data required by the
the data required by the scenario. scenario.
AO3: Provide solutions to problems by:
evaluating computer systems making reasoned judgements presenting conclusions
1–2
3–4
5–6 0
No creditable response.
Program seen without relevant
Program seen with some relevant
The program has been fully comments.
comment(s).
commented
Some identifier names used are
The majority of identifiers used are
Suitable identifiers with names appropriate
appropriately named.
meaningful to their purpose have Some of the data structures used
Most of the data structures used
been used throughout. have meaningful names.
have meaningful names.
All of the data structures used have meaningful names. The solution is illogical.
The solution contains parts that may
The program is in a logical order. be illogical.
The solution is inaccurate in many
The solution contains parts that are
The solution is accurate. places.
inaccurate.
Solution logically performs all the Solution contains few lines of code
Solution contains lines of code with
tasks given in the scenario. Ignore with errors that attempt to perform a
some errors that logically perform
minor syntax errors. task given in the scenario.
tasks given in the scenario. Ignore
minor syntax errors.
The solution attempts at least one of
The solution meets most of the
The solution meets all the the requirements.
requirements.
requirements given in the question. Solution contains lines of code that
Solution contains lines of code that
Solution performs all the tasks given attempt at least one task given in the
perform most tasks given in the
in the scenario.
scenario.
scenario.
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

