Computer Science · Oct / Nov 2021 · Paper 21 · Question 1
0478
As printed in the paper
The question as text
All variables, constants and other identifiers must have meaningful names.
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
1(a)[3]
Constant
NoCourts // NoSessions // NoBookingSlots
Value
8 // 10 // 80
Use
Storing the number of courts / sessions available / times and courts available for booking
1(b)[4]
Any four from:
Any three from
MP1
Identifier / name of array used
MP2
Description of purpose of an identified array
MP3
Length of an identified array used
MP4
Type of data in an identified array
MP5
Explanation of number of arrays used, must be capable of storing all data required
MP6
Sample data for an identified array
One mark
MP7
Identifying more than one array
E.g.4 arrays of ten elements for each squash court, for example for squash court 1 Availability1 of type Boolean, Guest1, Mobile1 and Code1 all type string
1(c)[3]
Any three from:
MP1
Setting the first code number
MP2
How to find subsequent code numbers
MP3
How to ensure they were unique
MP4
How to ensure they were exactly 4 digits
1(d)[6]
Any six from:
MP1
Input time
MP2
… with prompt
MP3
Check each court
MP4
If court not booked …
MP5
… set as booked
MP6
Input name, mobile number
MP7
Calculate unique 4-digit code
MP8
Store name, mobile number and 4-digit code in an array
MP9
Display mobile number and 4-digit code with suitable message
MP10 Change mobile number if necessary
Sample
OUTPUT ("Which time do you want to book a squash court")
INPUT BookTime
Booked ← FALSE
CourtNumber ← 0
IF BookTime >= 8 AND BookTime <= 17
THEN
BookTime ← BookTime - 7
IF Available1[BookTime] THEN Available1[BookTime] ← FALSE; CourtNumber ← 1; Booked ← TRUE ENDIF
IF NOT Booked AND Available2[BookTime] THEN Available2[BookTime] ← FALSE; CourtNumber ← 2; Booked ← TRUE ENDIF
IF NOT Booked AND Available3[BookTime] THEN Available3[BookTime] ← FALSE; CourtNumber ← 3; Booked ← TRUE ENDIF
IF NOT Booked AND Available4[BookTime] THEN Available4[BookTime] ← FALSE; CourtNumber ← 4; Booked ← TRUE ENDIF
IF NOT Booked AND Available5[BookTime] THEN Available5[BookTime] ← FALSE; CourtNumber ← 5; Booked ← TRUE ENDIF
IF NOT Booked AND Available6[BookTime] THEN Available6[BookTime] ← FALSE; CourtNumber ← 6; Booked ← TRUE ENDIF
IF NOT Booked AND Available7[BookTime] THEN Available7[BookTime] ← FALSE; CourtNumber ← 7; Booked ← TRUE ENDIF
IF NOT Booked AND Available8[BookTime] THEN Available8[BookTime] ← FALSE; CourtNumber ← 8; Booked ← TRUE ENDIF
IF NOT Booked OUTPUT("No court available at ", BookTime + 7)
ENDIF
IF Booked
THEN
OUTPUT ("Please enter your name")
INPUT Name
Code ← Code + 1
Correct ← "N"
WHILE Correct = "N" DO
OUTPUT ("Please enter your mobile number")
INPUT Mobile
OUTPUT ("Is Your mobile number correct Y/N? ", Mobile, " Your court number is ", CourtNumber, " Your entry code is ", Code)
INPUT Correct
ENDWHILE
CASE CourtNumber OF
1 : Guest1[BookTime}← Name; Mobile1[BookTime] ← Mobile; Code1[BookTime] ← Code 2 : Guest2[BookTime}← Name; Mobile2[BookTime] ← Mobile; Code2[BookTime] ← Code 3 : Guest3[BookTime}← Name; Mobile3[BookTime] ← Mobile; Code3[BookTime] ← Code 4 : Guest4[BookTime}← Name; Mobile4[BookTime] ← Mobile; Code4[BookTime] ← Code 5 : Guest5[BookTime}← Name; Mobile5[BookTime] ← Mobile; Code5[BookTime] ← Code 6 : Guest6[BookTime}← Name; Mobile6[BookTime] ← Mobile; Code6[BookTime] ← Code 7 : Guest6[BookTime}← Name; Mobile7[BookTime] ← Mobile; Code7[BookTime] ← Code 8 : Guest8[BookTime}← Name; Mobile8[BookTime] ← Mobile; Code8[BookTime] ← Code ENDCASE
NoCoutsBooked[BookTime] ← NoCoutsBooked[BookTime] - 1
ELSE
OUTPUT ("Court not booked”)
ENDIF
1(e)[4]
Explanation
Any four from
MP1
How the program totalled the number of bookings
MP2
How the program displayed the total number of bookings
MP3
How the program calculated the number of times each court was booked
MP4
How the program selected the highest value for times a court was booked
MP5
How the program displayed the court that was most booked
Programming statements must be included and must be explained.
Section B
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

