ExamBank Scot · Higher Computing Science question bank · All Higher Computing Science questions

Higher Computing Science 2019 Question 14

7 marks · Design notations and data flow

The table below has the data flow completed for steps 1 and 3 of the algorithm. Complete the missing data flow for step 2. Step IN/OUT Data flow 1 IN OUT hotelname[], stars[],price[], reviews[] 2 IN OUT 3 IN position, hotelname[], stars[],price[], reviews[] OUT Step 2 finds the position of the cheapest hotel with five stars. Using a recognised design technique, design this step. A travel company performs a search on a particular location and exports the following data about hotels to a text file. • Hotel name • Star rating from 1 to 5 • The price per night for a room • Review score from previous guests from 0 to 10 A sample of the data in the text file is shown below. Club Praia de Oure,4,47.00,7.0 Adriano Beach Club,4,121.25,8.3 … A program is required to make recommendations to customers. One end-user requirement is to find the cheapest five star hotel. The algorithm used is shown below. 1. Import hotel data 2. Find the position of cheapest five star hotel 3. Display cheapest five star hotel

Marking scheme

• In: stars[], price[] • Out: position 1 mark for each bullet Any additional entries in a row, award 0 marks for that row. • Initialisation of position and lowest that does not cause an error ie position < 0 and lowest as a suitable high value • Condition stars = 5 • Condition price < lowest value • Assign lowest OR use of price (position) in the condition • Assign position 1 mark for each bullet Set position to -1 Set lowest to 1000 Loop for each hotel If current stars = 5 and current price < lowest Set lowest to current price Set position to index End if End loop Award 4 marks if position of price is used eg Set position to -1/0 (no mark) Loop for each hotel If current stars=5 and current price<price [position] Set position to current index End if End loop Do not penalise incorrect shapes in graphical notations.

Previous question: Higher Computing Science 2019 Question 13

Next question: Higher Computing Science 2019 Question 15