Question 3

OCR Computer Science June 2019 Paper 2GCSE4 marks

On the specification

(a)(i)
2.3 Producing robust programs
(a)(ii)
2.3 Producing robust programs2.4 Computational logic
(b)(i)
2.3 Producing robust programs
(b)(ii)
2.3 Producing robust programs
Question text

3 Louise writes a program to work out if a number entered by the user is odd or even. Her first attempt at this program is shown. 1 num = input(“enter a number”) 2 if num MOD 2 >= 0 then 3 print(“even”) 4 else 5 pritn(“odd”) 6 endif (a) The program contains a logic error on line 02. (i) State what is meant by a logic error. [1] (ii) Give a corrected version of line 02 that fixes the logic error. [1] (b) The program contains a syntax error on line 05. (i) State what is meant by a syntax error. [1] (ii) Give a corrected version of line 05 that fixes the syntax error. [1]