ExamBank Scot · N5 Computing Science question bank · All N5 Computing Science questions
4 marks · Data types and structures
Passengers must enter their destination and their age when making a booking, as some will qualify for free travel. Complete the table below to state the most suitable data types that should be used. Variable name Sample data Data type passengerAge 78 destination Ullapool Write a line of code that will randomly allocate a seat number and store this in the variable seatNum. There are 50 seats available. A program is required for passengers to book a ticket on a bus.
• integer • string Accept int, str • assignment to seatnum • random function generating 50 values