TK Study

Multiple choice › Testing

Testing

1. Testing

Which set of test data is MOST useful for the rule 'accept ages from 13 to 18 inclusive'?

  1. 12, 13, 18, 19
  2. 1, 2, 3, 4
  3. 13, 14, 15, 16
  4. 20, 30, 40, 50
Answer

A

Test boundaries on both sides of each limit (12/13 and 18/19), plus a typical value.

2. Testing

Which of these is a LOGIC error?

  1. Dividing by zero when the user enters 0
  2. Forgetting a colon after if in Python
  3. Misspelling print as pritn
  4. A program that calculates an average by dividing by 10 instead of the count of numbers
Answer

D

Logic errors run but give wrong results. Syntax errors stop the code compiling/running; runtime errors crash during execution (e.g. divide by zero).