Question 4

OCR Computer Science November 2021 Paper 2GCSE7 marks

On the specification

(a)
2.2 Programming techniques
(b)(i)
2.2 Programming techniques
(b)(ii)
2.2 Programming techniques2.4 Computational logic
(b)(iii)
2.4 Computational logic
(c)(i)
2.2 Programming techniques
(c)(ii)
2.2 Programming techniques
(c)(iii)
2.2 Programming techniques
Question text

4 A programmer declares the following variables. first = "Computer Science" second = "is great" (a) State one difference between a variable and a constant. [1] (b) State the output from the following lines of program code. (i) print(first.length) [1] (ii) print(second.length DIV 3) [1] (iii) print(3 ^ 2) [1] (c) Strings can be concatenated (joined together) using the + operator. For example, print("Maths " + second) will output Maths is great Use string manipulation with the variables first and/or second to produce the following output. (i) great [1] (ii) Computer [1] (iii) Science is great [1]