ExamBank Scot · Higher Computing Science question bank · All Higher Computing Science questions
11 marks · Design notations and data flow
Complete the table below to show the missing data flow for steps 2, 3 and 4. Step IN/OUT Data flow 1 IN OUT date[], distance[], drivingTime[] 2 IN OUT 3 IN OUT avgDistance 4 IN OUT Explain how the data flow identified at the design stage would assist the programmer when implementing the code for the program. Step 3 calculates the average distance for journeys longer than one hour. Using a design technique of your choice, design an algorithm for step 3. The company has been the target of a Denial of Service (DOS) attack involving resource starvation. Describe what is meant by a resource starvation DOS attack. State one cost to the company as a result of a DOS attack. An insurance company requires that a black box is installed in an insured car to store data about each journey. The black box records data for each journey including: • date of travel • distance travelled in miles • time spent driving in hours (for example 1 hour 15 minutes is stored as 1.25). A sample of the data is shown below. 09/03/2024, 40.25, 1.25 04/04/2024, 5.12, 0.17 04/04/2024, 5.12, 0.21 … A program is written to analyse this data. The top‑level design for the program is shown below. 1. Read the data from a text file into parallel 1D arrays. 2. Calculate the average speed for each individual journey by dividing the distance for that journey by the time taken for that journey. 3. Calculate the average distance travelled for journeys longer than one hour. 4. Write the average speed of all journeys that have a greater distance than the average distance to a file.
STEP 2 IN: distance[],drivingTime[] STEP 2 OUT: avgSpeed[] STEP 3 IN: distance[],drivingTime[] STEP 4 IN: avgSpeed[],distance[],avgDistance Award 1 mark for each step STEP 2 OUT: must indicate an array, shape of brackets is not relevant If avgSpeed variable is passed out of Step 2 without brackets do not penalise again at Step 4 IN If candidate has entered any data flow for Step 1 IN or Step 4 OUT do not award marks for that Step Identifies parameters/variables • Initialisation of journeys and total distance, increment of number of journeys • Loop and update of total distance • If statement with correct condition • Correct calculation of average System resources such as processor/backing storage/RAM are exhausted/fully utilised • Loss of revenue • Repair (of damage due to attack) • Prevention of future attacks Maintenance would be ongoing and not solely as a result of a DOS attack