Computer Science · May / June 2022 · 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)[3]
Many correct answers, the name used must be meaningful. The name given is an example only.
One mark per mark point, max three
Constant
AdultCostOneDay
Value
20.00
Use
Storing the cost of an adult ticket for one day
1(a)(ii)[3]
Many correct answers, the name used must be meaningful. The name given is an example only.
One mark per mark point, max three
Variable
NumberOfTickets // NumberOfAdultTickets
Data type
Integer
Use
Inputting the number of tickets purchased // Inputting the number of adult tickets purchased
1(b)[3]
One mark per mark point, max three
MP1
using an array or variables // lookup // input today’s date
MP2
use a loop / FOR / REPEAT / WHILE statement
MP3
… to output / display today’s date / today using a suitable message
MP4
… and the 6/7 following dates/days // loop 6/7 times
or
MP5
using an array or variables // lookup // input today’s date
MP6
array/ variables contains all the days of the week / the next seven days or dates
MP7
attempt to output / display available days using a suitable message(s)
1(c)[2]
One mark per mark point, max two
MP1
method used to allocate a new number, e.g. initialise a variable or counter // select a random number
MP2
how it ensured uniqueness, e.g. every booking number is one larger than the previous number
// check existing bookings to ensure it hasn’t been used before
1(d)[6]
One mark per mark point, max six
MP1
initialise a running total for the cost of the booking
MP2
input (with prompt) the number of tickets
MP3
… attempt to identify type of ticket
MP4
… add the cost of tickets to the running total
MP5
ability to book several types of ticket
MP6
attempt to check that the number of children booked is less than or equal to twice the number of adults
MP7
attempt to identify type of attraction
MP8
input with prompt the number of selected attractions required
MP9
… check that this number is not greater than the total number of tickets booked
MP10
… add the cost of the attractions to the (running) total
Example answer
TotalCost ← 0
TotalPeople ← 0
OUTPUT "Do you want single tickets? Y/N"
INPUT Single
IF Single = "Y"
THEN
FOR Type ← 1 TO 3 // adults, children and seniors
REPEAT
Flag ← True
OUTPUT "How many ",TicketDecription[Type], " tickets"
INPUT NumberOfTickets[Type]
IF Type = 2
THEN
IF NumberOfTickets[2] > 2 * NumberOfTickets[1]
THEN
Flag ← FALSE
OUTPUT "Too many children"
ENDIF
ENDIF
UNTIL NumberOfTickets[Type] >= 0 AND Flag
TotalCost ← TotalCost + TicketPrice[Type] * NumberOfTickets[Type]
TotalPeople ← TotalPeople + NumberOfTickets[Type]
NEXT Type
ENDIF
OUTPUT "Do you want a family ticket? Y/N"
INPUT Family
IF Family = "Y"
THEN
OUTPUT "How many?"
INPUT NumberOfTickets[4]
TotalCost ← TotalCost + TicketPrice[4] * NumberOfTickets[4]
TotalPeople ← TotalPeople + NumberOfTickets[4] * 5
ENDIF
OUTPUT "Do you want a group ticket? Y/N"
INPUT Group
IF Group = "Y"
THEN
OUTPUT "How many people in the group?"
INPUT NumberOfTickets[5]
TotalCost ← TotalCost + TicketPrice[5] * NumberOfTickets[5]
TotalPeople ← TotalPeople + NumberOfTickets[5]
ENDIF
REPEAT
OUTPUT "How many people would like to see the lion feeding?"
INPUT LionFeedingNumber
IF TotalPeople >= LionFeedingNumber
THEN TotalCost ← TotalCost + LionFeedingNumber * LionfeedingPrice
ENDIF
OUTUT "How many people would like to see the penguin feeding?"
INPUT PenguinFeedingNumber
IF TotalPeople >= PenguinFeedingNumber
THEN TotalCost ← TotalCost + PenguinFeedingNumber * PenguinfeedingPrice
ENDIF
UNTIL TotalPeople >= PenguinFeedingNumber AND TotalPeople >= LionFeedingNumber
1(e)[3]
Explanation
One mark per mark point, max three
MP1
use of selection (or any other method) to identify bookings with 2 or more adults and/or seniors and 2 (allow 3) or more children
MP2
calculating new price including family ticket(s) for booking / tickets sold
MP3
… use of condition to compare price of family ticket(s) to price of ordinary tickets / group ticket(s) …
MP4
… identifying best value / lowest cost
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.

