Question 5

OCR Computer Science June 2023 Computational thinking, algorithms and programming (J277-02)GCSE20 marks

On the specification

(a)(i)
2.3 Producing robust programs
(a)(ii)
2.3 Producing robust programs
(a)(iii)
2.5 Programming languages and IDEs
(b)
2.3 Producing robust programs
(c)
2.1 Algorithms2.2 Programming fundamentals
Question text

5 Charlie is developing an adding game. The rules of the game are: • the player is asked 3 addition questions • each question asks the player to add together two random whole numbers between 1 and 10 inclusive • if the player gets the correct answer, 1 is added to their score • at the end of the game their score is displayed. (a) Charlie has been told that the game will need to be tested before giving it to the players. (i) Explain why programs should be tested before use. [2] (ii) Complete the table by naming and describing one type of test that should be used on Charlie's program before releasing it. Test type Description [2] (iii) Complete the table by identifying and describing two features of an IDE that can be used when testing a program. Feature Description [4] (b) Validating inputs can reduce errors when a program is being run. Identify two methods of validation and explain how they can be used on this game. Validation method 1 Use Validation method 2 Use [6] (c) Write an algorithm to play this game. The rules are repeated from the start of the question here: • the player is asked 3 addition questions • each question asks the player to add together two random whole numbers between 1 and 10 inclusive • if the player gets the correct answer, 1 is added to their score • at the end of the game their score is displayed. [6] We advise you to spend at least 40 minutes on this section. Some questions require you to respond using either the OCR Exam Reference Language or a high-level programming language you have studied. These are clearly shown.