Question 6
OCR Computer Science June 2025 Computer principles (H046-01)AS13 marks
On the specification
- (a)
- 1.4 Data types, data structures and algorithms
- (b)(i)
- 1.4 Data types, data structures and algorithms
- (b)(ii)
- 2.2 Problem solving and programming
- (c)
- 1.2 Software and software development
Question text
6 Beth records how many steps she has completed over a seven-day period. She stores the total number of steps for each day in a text file. For example: "9000" , "13680" , "11254" , "8258" , "12326" , "9244" , "7542" Beth would like a program that will take the values from the text file and then calculate the average number of steps per day. (a) Beth has realised that she will need to convert the data from the text file to another data type. State the data type the values will need to be converted to and state the reason why. Data type Reason [2] (b) The values from the text file are copied into a 1d-array called steps when the program starts. For example: 9,000 13,680 11,254 8,258 12,326 9,244 7,542 Beth passes the array steps into a function called findAverage which will return the average number of steps. (i) An alternative data structure Beth could have used is a list. Describe two differences between a list and an array. 1 2 [4] (ii) Write the function findAverage that will accept the array steps as a parameter and then return the average number of steps. You should write your answer using pseudocode or program code. [5] (c) Beth needs to translate her code using a compiler or an interpreter. Describe one benefit to Beth of using a compiler instead of an interpreter. [2]