Question bank › GCSE Computer Science › Programming

Testing, test data & error types

Answer on paper first, then reveal the mark scheme one mark at a time.

1Grade 4–54 marks

(a) Explain the difference between a syntax error and a logic error. [2]

(b) For each line below, state whether it contains a syntax error or a logic error. [2]

(i) IF score > 50 THN

(ii) A program meant to find the mean of 5 numbers uses mean ← total / 4

2Grade 4–54 marks

A program accepts the age of a student at a secondary school. Valid ages are 11 to 18 inclusive.

(a) Give an example of each type of test data and state the expected result. [3]

(i) normal (ii) boundary (iii) erroneous

(b) Explain why a programmer tests a program with erroneous data. [1]

3Grade 6–76 marks

A subroutine should return True if a test mark is valid. Valid marks are from 0 to 100 inclusive.

SUBROUTINE validMark(mark)
   IF mark > 0 AND mark < 100 THEN
      RETURN True
   ELSE
      RETURN False
   ENDIF
ENDSUBROUTINE

(a) The subroutine is tested with the marks 50, 0, 100 and 101. For each test, state the expected result and the actual result. [2]

(b) State the type of error in the subroutine. [1]

(c) Rewrite the condition in the IF statement so that the subroutine works correctly. [1]

(d) Explain why testing with only normal data would not have found this error. [1]

(e) The program reads mark using STRING_TO_INT(USERINPUT). Explain why the program could still fail if a user types ten. [1]

Still losing marks on this topic?

Book a free introductory session and we'll find exactly which step is costing you.

Book a free intro