Note AcademyNote Academy

Computer Science · May / June 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)[3]

    Array

    TrainUpPassengers // TrainUpPassengers[]

    Data type

    Integer/int

    Use

    storing the number of passengers on the train journeys up

    Many correct answers, this is an example.

  • 1(b)[6]

    One mark for description, one mark for normal data and one mark for erroneous data for two checks

    Validation check (type check) to check that the number entered is a whole number / integer

    Normal data

    34

    Erroneous data

    two // 1.5

    Validation check (range check) to check that the value of the number entered is between 1 and 80 / 480 inclusive Normal data

    34

    Erroneous data

    99 // 500

    Validation check (presence check) to check that a value has been entered

    Normal data

    34 // any data entered

    Erroneous data

    “” // blank // no data entered

    Validation check (length check) to check that a value has 3 digits or fewer // between 1 and 3 digits

    Normal data

    345

    Erroneous data

    3456

    Many correct answers, the data are examples only.

  • 1(c)[6]

    Any six from:

    MP1

    Input number of tickets

    MP2

    Input train up mountain and train down mountain

    MP3

    Suitable prompts seen for inputs that are included

    MP4

    Check that tickets are available on selected train(s)

    MP5

    If available calculate price of tickets …

    MP6

    … calculation includes discount if required

    MP7

    Update total passengers / seats available for a train

    MP8

    Update total passengers / seats available for up train and down train

    MP9

    Update total cost for a train

    MP10 Update total cost for up train and down train

    Example answers

    OUTPUT "How many tickets"

    INPUT NoTickets

    OUTPUT "Which Train up the mountain? 1, 2, 3 or 4"

    INPUT UpNumber

    OUTPUT "Which Train down the mountain? 1, 2, 3 or 4"

    INPUT DownNumber

    IF (DownNumber = 4 AND TrainUp[UpNumber] + NoTickets <= 480 AND TrainDown[DownNumber] + NoTickets <= 640) OR (TrainUp[UpNumber] + NoTickets <= 480 AND TrainDown[DownNumber] + NoTickets <= 480)

    THEN

    Cost ← (NoTickets – NoTickets DIV 10) * 50

    TrainUp[UpNumber] ← TrainUp[UpNumber] + NoTickets

    TrainDown[DownNumber] ← TrainUp[DownNumber] + NoTickets

    TrainUpTotal[UpNumber] ← TrainUpTotal[UpNumber] + Cost / 2

    TrainDownTotal[DownNumber] ← TrainDownTotal[DownNumber] + Cost / 2

    ENDIF

    START

    OUTPUT "Tickets"

    INPUT Tickets

    OUTPUT "Up Train"

    INPUT UpNo

    OUTPUT "Down Train"

    Yes

    INPUT DownNo

    No

    Is Tickets <=

    UpTickets[UpNo] AND

    Tickets <=

    DownTickets[DownNo]?

    Yes

    Cost ← (NoTickets – NoTickets DIV 10) * 50

    TrainUp[UpNo] ← TrainUp[UpNo] + NoTickets

    TrainDown[DownNo] ← TrainUp[DownNo] + NoTickets

    TrainUpTotal[UpNo] ← TrainUpTotal[UpNo] + Cost / 2

    TrainDownTotal[DownNo] ← TrainDownTotal[DownNo] + Cost / 2

    END

  • 1(d)[5]

    Explanation

    Any five from:

    MP1

    How the program displayed the number of passengers for a journey ...

    MP2

    … how completed for all trains

    MP3

    How the program displayed the amount of money taken for a journey …

    MP4

    … how completed for all trains

    MP5

    How the program calculated the total number of passengers

    MP6

    How the program calculated the total money taken

    MP7

    How the program attempted to select the train journey with the most passengers

    MP8

    How the program attempted to dealt with more than one train being the most popular

    MP9

    How the program displayed the results with suitable messages

    Programming statements must be given with each explanation.

    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.