Question 3

OCR Computer Science June 2017 Paper 2AS36 marks

On the specification

(c)(i)
2.2 Problem solving and programming
(c)(ii)
2.2 Problem solving and programming
(c)(iii)
2.2 Problem solving and programming
(d)
2.1 Elements of computational thinking2.2 Problem solving and programming
(e)
2.1 Elements of computational thinking
(a)
2.2 Problem solving and programming
(b)
2.2 Problem solving and programming
(c)(i)
3.2 Programming project: Design of the solution
(c)(ii)
3.2 Programming project: Design of the solution
Question text

3 [6] (c) The following pseudocode algorithm is for the sub-procedure characterMovement. procedure characterMovement(inputKey:byVal, characterx:byRef, charactery:byRef) if inputKey == 37 then characterx = characterx + 1 elseif inputKey == 38 then charactery = charactery + 1 elseif inputKey == 39 then characterx = characterx – 1 elseif inputKey == 40 then charactery = charactery – 1 endif endprocedure (i) Identify the three parameters in the procedure characterMovement. 1 2 3 [3] (ii) Describe the decision that is made in this procedure and how the decision affects the flow through the procedure. [3] (iii) Explain why characterx and charactery are passed byRef and not byVal. [3] (d)* Discuss the need for, and benefits of, the students producing and using reusable program components in the development of the game. [9] (e) Explain, using examples, how abstraction would be used to create the virtual world. [4] 3 A procedure takes as input a number between 1 and 100. It calculates and outputs the square of each number starting from 1, to the number input. The square of a number is the result of multiplying a number by itself. procedure squares() do number = int(input("Enter a number between 1 and 100")) until number >= 1 AND number <= 100 for x = 1 to number print(x * x) next x endprocedure (a) The procedure uses one programming construct twice. State whether the construct that is used twice, is iteration or branching. [1] (b) State why the algorithm is a procedure and not a function. [1] (c) The procedure needs to be tested. (i) Describe how black box testing can be used to test a program. [3] (ii) For each type of test given in the table, identify two examples of test data that can be used to test the program. Test Type Test Data 1 Test Data 2 Normal Extreme Invalid [3]