Paper 1 Validation Testing Drills
These are original Paper 1-style practice questions. They use concrete data and code fragments so the answers can be checked exactly.
Detailed answers are in Paper 1 Validation Testing Answers.
Revise the topic hub first:
Questions
Question 1: Validation vs Verification
A student types this email address into a registration form:
amy@example.comFor this simplified form rule, the form checks that the text contains @ and .. The form also asks the student to type the email address a second time and checks that both entries match.
Identify which check is validation and which check is verification. [2]
Question 2: Range Check
A mark must be a whole number from 0 to 100 inclusive. Assume mark is already an integer.
State the Boolean condition that accepts a valid mark. [1]
Question 3: Format Check
A membership code must have exactly two uppercase letters followed by four digits, for example:
AB1234For each code, state whether it is valid.
| Code | Valid? |
|---|---|
AB1234 | |
A12345 | |
Ab1234 | |
CD12E4 |
[4]
Question 4: Presence Check
A form has a required student_id field. The submitted value is:
" "Explain why a presence check should reject this value. [2]
Question 5: Check Digit
A four-digit code uses this check-digit rule:
The final digit must equal the sum of the first three digits modulo 10.For each code, state whether the check digit is valid:
| Code | Valid? |
|---|---|
2462 | |
2463 |
Then state one limitation of a check digit. [3]
Question 6: Test Data Types
A function valid_age(age) should accept ages from 13 to 18 inclusive.
Give one normal, two extreme, and two abnormal test values. [5]
Question 7: Error Type
Classify each error as syntax, runtime, or logic.
| Code or behaviour | Error type |
|---|---|
if mark >= 50 | |
average = total / count crashes when count is 0 | |
if mark > 50 gives "Fail" for mark = 50, although 50 should pass |
[3]
Question 8: Debugging Trace
This code is meant to calculate the sum of [1, 2, 3], but after the loop total is 3 instead of 6.
total = 0
for n in [1, 2, 3]:
total = nComplete a trace table showing n and total after assignment for all three iterations, and identify the logic error. [4]
Question 9: Test Plan
Design a test plan for:
valid_mark(mark): returns True when 0 <= mark <= 100Include four tests: one normal valid value, two extreme values, and one abnormal value. [4]
Question 10: Predictable Runtime Error
This code converts user input into an integer:
mark = int(text)If text is "abc":
- identify the error type;
- state the specific exception that should be caught;
- explain why a broad bare
exceptis less helpful for debugging.
[3]
Review Checklist
After attempting these questions, check whether you can:
- distinguish validation from verification in a scenario;
- state exact validation conditions;
- classify test data and error types from concrete examples;
- use a trace table to locate a logic error;
- design tests with expected results;
- explain why specific exception handling helps debugging.