Question 5

Edexcel Computer Science June 2020 Paper 2GCSE13 marks

On the specification

(a)
6.2 Program constructs
(b)
6.3 Data types and structures
(c)(i)
6.5 Operators
(c)(ii)
1.2 Algorithms6.5 Operators
Question text

5 A train runs from the airport to the city centre. Passengers purchase tickets from a ticket machine at the station. Journeys must start within two hours of purchasing a ticket. (a) Here is a diagram of a ticket machine. Coins in Display Notes in Airport Express Tickets Coins out Ticket Complete the table to give an input, a process and an output. (3) Input Process Output Calculate change Change Current time Expiry time Expiry time Print (b) Here is a ticket for the airport train. Ticket number: 4938 Expiry: 03–08–2020 13:20 Amount paid: 22.45 The ticket number is incremented by 1 each time a ticket is printed. Complete the table to give the appropriate data type for each item. (3) Item Data type Ticket number Expiry Amount paid (c) The ticket machine executes a program to determine the amount and type of change returned when a passenger purchases a ticket. Here is the code that determines the amount and type of change. (i) Explain why integer division (DIV) and modulus (MOD) rather than division (/) are used in this algorithm. (2) (ii) Complete the trace table showing the execution of the code when change = 17.55 You may not need to fill in all the rows in the table. (5) pence tens fives ones fiftyP twentyP tenP fiveP 1755 (Total for Question 5 = 13 marks)