Computer Science · May / June 2020 · 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)[4]
For two variables
One mark for identification of a variable with a suitable data type and one mark for its use
Variable
hourArrived
Data type
integer
Use
to calculate the price based on the number of hours parking
Variable
priceToPay
Data type
real
Use
store result of price calculation
Many correct answers, these are examples only.
1(b)[4]
For each validation check
One mark for identification of a check and one mark for the justification
Day
Check
presence check
Justification
need to enter day to be able to calculate price
Hour
Check
range check
Justification
need to check hour is between 8 and 23
Many correct answers, these are examples only.
1(c)[4]
Any four from:
All 5 digits inputEach of the first 4 digits is multiplied by a weight based on its positionSpecific method of individualising the digits describedAdded together divided by 11Remainder used to calculate correct 5th digitChecked against 5th digit inputIf the same, then valid1(d)[4]
Any four from:
Input amountCheck amount greater than or equal to the price to pay …… True – add amount to daily total… False – ask for payment to be re-entered… Until valid amount inputSample answer
PRINT "Please Enter Payment"
INPUT amount
WHILE amount < priceToPay DO
PRINT "Insufficient payment, please enter new Payment"
INPUT amount
ENDWHILE
totalPayment ← totalPayment + amount
1(e)[4]
Explanation
Any four from:
Add number of hours selected to arrival hourCheck if this is greater than 16True – calculate price up to 16 …… using current price in force… and add in evening chargeFalse – calculate price as usualProgramming statements can be used but must be explained.
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

