Note AcademyNote Academy

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 input
    Each of the first 4 digits is multiplied by a weight based on its position
    Specific method of individualising the digits described
    Added together divided by 11
    Remainder used to calculate correct 5th digit
    Checked against 5th digit input
    If the same, then valid
  • 1(d)[4]

    Any four from:

    Input amount
    Check 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 input

    Sample 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 hour
    Check if this is greater than 16
    True – calculate price up to 16 …
    … using current price in force
    … and add in evening charge
    False – calculate price as usual

    Programming 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.