Question 6

OCR Computer Science Sample papers Paper 2GCSE21 marks

On the specification

(a)
2.2 Programming fundamentals
(b)(i)
2.2 Programming fundamentals
(b)(ii)
2.2 Programming fundamentals
(c)(i)
2.2 Programming fundamentals
(c)(ii)
2.2 Programming fundamentals
(c)(iii)
2.2 Programming fundamentals
(c)(iv)
2.1 Algorithms2.2 Programming fundamentals
(d)
2.2 Programming fundamentals
(e)
2.1 Algorithms2.2 Programming fundamentals
Question text

6 Heath is researching how long, to the nearest minute, each student in his class spends playing computer games in one week (Monday to Friday). He is storing the data in a 2D array. Fig. 2 shows part of the array, with 4 students. Fig. 2 Students 1 2 3 012 18020060Specimen306030 4500 60200 3 60 10 15 15 4 100 35 30 45 For example, student 1, on Monday (day 0), played 30 minutes of computer games. (a) Explain why Heath is using an array to store the data. (b) (i) Identify a data type that could be used to store the number of minutes in this array. (ii) State why this data type is the most appropriate. (c) Heath wants to output the number of minutes student 3 played computer games on Wednesday (day 2). He writes the code: print (hoursPlayed[3,2]) The output is 20. (i) Write the code to output the number of minutes student 0 played computer games on Wednesday. (ii) State the output if Heath runs the code: print (hoursPlayed[2,1]) (iii) State the output if Heath runs the code: print (hoursPlayed[3,1] + hoursPlayed[3,2]) Specimen [1] (iv) Write an algorithm to output the total number of minutes student 0 played computer games from Monday (day 0) to Friday (day 4). (d) Heath has the day of the week stored as a number e.g. 0 = Monday, 1 = Tuesday. Write a sub-program that takes the number as a parameter and returns the day of the week as a string. Specimen (e) Heath needs to work out the average number of minutes spent playing computer games each day for the class, which contains 30 students. Write an algorithm to output the average number of minutes the whole class spends playing computer games each day. Specimen