ExamBank Scot · Higher Computing Science question bank · All Higher Computing Science questions
10 marks · Software analysis
During the analysis stage boundaries are identified. State two boundaries for this task. Using a programming language of your choice, define a suitable record data structure for the data above. Using a programming language of your choice, define the variable which can store the details of the 200 readings. Your answer should use the record data structure created in part (i). Using a recognised design technique, design an algorithm to find the maximum speed. A car manufacturer includes an event data recorder in their cars. This device begins recording when the car’s sensors detect a sudden change in speed. The data captured can be analysed when required. A sample of data is shown below. Event data Sample speed (mph) 58.2 accelerator (%) 42 brake (%) 0 seatbelt on True When triggered by a sensor this data is sampled 10 times per second for 20 seconds. Software is to be developed that can analyse the data captured from a car’s event data recorder.
• 200 readings/values • Accelerator OR brake maximum 100 (%) OR minimum 0 • Speed minimum is 0 OR maximum dependent on car • Data is accurate as it is captured from sensors. • No input validation required 1 mark for each bullet Maximum 2 marks • Record structure with name • Four fields specified 1 mark for each bullet Record structure could be Type, Structure, Class, Named Tuple, Record name Is Livecode Global CarData Put empty into CarData[1][speed] Put empty into CarData[1][accel] Put empty into CarData[1][brake] Put empty into CarData[1][seatb] Defining a RECORD structure does not start with DECLARE – do not award first bullet • Array structure • Using data type created in (i) 1 mark for each bullet Example Python: readings=[datatype_a() for x in range (200)] Example VB: DIM readings(199) AS datatype_a Example Livecode: Set the data of EventData to CarData • Initial set of max • Loop traversing array with termination • If condition • Assignment of max 1 mark for each bullet Set max to first speed Loop to end of array If current speed > max then Set max to current speed ( End If End Loop) Do not penalise incorrect shapes in graphical notations.
Previous question: Higher Computing Science 2019 Question 10