Question 2

OCR Computer Science June 2018 Paper 2GCSE8 marks

On the specification

(a)(i)
2.1 Algorithms2.2 Programming techniques
(a)(ii)
2.1 Algorithms2.2 Programming techniques
(b)
2.2 Programming techniques
(c)(i)
2.2 Programming techniques
(c)(ii)
2.2 Programming techniques
Question text

2 A programmer has written an algorithm to output a series of numbers. The algorithm is shown below: 1 for k = 1 to 3 2 for p = 1 to 5 3 print (k + p) 4 next p 5 next k 6 m = 7 7 print m * m (a) (i) Give the first three numbers that will be printed by this algorithm. [1] (ii) State how many times line 03 will be executed if the algorithm runs through once. [1] (b) Identify two basic programming constructs that have been used in this algorithm. 1 2 [2] (c) (i) Describe what is meant by a variable. [2] (ii) Identify two variables that have been used in the algorithm above. 1 2 [2]