Computer Science · Oct / Nov 2021 · Paper 22 · 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)(i)[2]
One mark per point
VariablePassengerID// StartStage
UseStoring the unique ID number of the passenger// Storing/inputting the start stage of the journey
1(a)(ii)[5]
One mark per point
MP1 Name of array
MP2 Data type of array
MP3 Sample data for array
MP4 Use of array
MP5 At least two complete arrays with all of the above
Array name
Data type Sample data Use
JourneyStage1 string
C1
to store the code for the home to start station
PriceStage1 real
1.50
to store the price of first stage of the journey
1(b)[3]
One mark per bullet point
MP1
Use of validation check, e.g. range check, type check, presence check, length check, format check
MP2
Use of conditional statement to check if the validation fails ...
MP3
… a re-entry is requested
MP4
Use of loop to repeat the process until an acceptable answer is input
MP5
More than one appropriate validation check used / described.
1(c)[6]
Any six from:
MP1
Conditional statement to check departure time against 10:00
MP2
… calculate 40% discount // calculate 60% of the original price
MP3
… calculate discounted total price
MP4
Output the discounted total price
MP5
Output the booking details with suitable messages
MP6
Input with prompt for passenger confirmation …
MP7
… attempt at action following the confirmation input
MP8
Repeating booking data entry if incorrect
MP9
Re-checking journey details for correctness
Example answer
// Tasks 1 and 2 completed
IF CollectedTime[Index] > 10:00
THEN
JourneyCost[Index] ← JouneyCost[Index] * 0.6
ENDIF
PRINT "Your journey cost is: ", JourneyCost[Index]
PRINT "Your journey details are: ", PassengerID[Index], JourneyTime[Index],
JourneyCodes[Index], JourneyID[Index]
PRINT "Are these details correct? (Y or N)"
INPUT Correct
IF Correct = "N"
THEN
WHILE Correct = "N"
PRINT "Re-enter your journey details"
PRINT "Correct passenger ID "
INPUT PassengerID[Index]
PRINT "Correct journey time "
INPUT JourneyTime[Index]
PRINT "Correct journey codes "
INPUT JourneyCodes[Index]
PRINT "Your revised journey details are: ", PassengerID[Index],
JourneyTime[Index], JourneyCodes[Index]
PRINT "Are these details correct? (Y or N)"
INPUT Correct
ENDWHILE
ENDIF
//Program continues
1(d)[4]
Explanation of how each of the following could be done
Any four from:
MP1
Declaring/using a counter to store the number of bookings for each passenger
MP2
Updating the counter for the number of bookings made by each passenger
MP3
Attempt to check the number of bookings …
MP4
… for the correct condition e.g. if the number of bookings is more than 10 / equal to 10
MP5
Apply the extra discount to the total price of future journeys
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.

