Past-paper question · 2016 May-June · Paper 21 · Q5(c)

Question 5(c) 2016 · May-June · Paper 21 · 10 marks

Original past-paper question for 5(C)
Original past-paper question for 5(C)
Original past-paper question for 5(C)
Original past-paper question for 5(C)
Reveal official mark-scheme answer

The answer for this question is in the official mark scheme: open the mark scheme.

Mark scheme 9691_s16_ms_21.pdf →

Show text version of question

Question 5

Part (c)

Question 5

Sports Stadium

Journeys can start and end at any of the following stations. Travel can be in either direction.

The distances between adjacent stations are:

Between stations Distance (km) 1 and 2 4 2 and 3 2 3 and 4 1 4 and 5 3

To use the ticket price calculator, a user clicks on the ‘Ticket Price Calculator’ button. This calls the procedure TicketCalculator. The user inputs the numbers of their chosen start and end stations. The procedure calculates and displays the ticket price.

Question 7

Part (c)

Use the flowchart opposite to write program code for the procedure TicketCalculator.

Programming language ............................................................................................................

Code .........................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

............................................................................................................................................

[10]

Question 9

PROCEDURE TicketCalculator

INPUT Origin

INPUT Destination

Initialise Distance

Yes Swap Origin and Is Origin > Destination? Destination

No

i@Origin

Loop

Distance@Distance + Interval[i] Increment i

No Is i = Destination - 1?

Yes

TicketPrice @ Distance * 0.25

OUTPUT TicketPrice

ENDPROCEDURE

Question 10

3 Alessio has been asked to write a computerised table booking system for a restaurant. The restaurant has 12 tables, each seating between 2 and 8 people.

The restaurant manager wants the following facilities:

  • take a new booking
  • cancel a booking
  • report on which table(s) are available

As a first attempt, Alessio designs his program to take bookings for one evening only. Each table is only booked once per evening.

He writes the pseudocode for his main program:

CALL Initialisation EndProgram ← FALSE REPEAT CALL DisplayOptions INPUT Option CASE OF Option 1: CALL TakeBooking 2: CALL CancelBooking 3: CALL AvailableTablesReport 4: EndProgram ← TRUE OTHERWISE OUTPUT "Error – invalid input" ENDCASE UNTIL EndProgram = TRUE

Each booking is for a number of customers (size of the group). Each table has a number of seats. The procedure Initialisation will set up arrays TableSeats, Booked and GroupSize as follows:

TableNumber TableSeats Booked GroupSize

1 2 1 FALSE 1 0

2 2 2 FALSE 2 0

3 2 3 FALSE 3 0

4 2 4 FALSE 4 0

5 4 5 FALSE 5 0

Topic relevance

Why this question appears here

82% assigned-topic match · Programming › Constructs

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 9691_s16_qp_21.pdf

Keep practising this topic