Paper 1 Validation Testing Answers
These answers correspond to Paper 1 Validation Testing Drills.
Answer 1: Validation vs Verification
- Checking that the email contains
@and.is validation, because it checks whether the entry satisfies the form’s stated format rule. - Asking for the email twice and comparing the entries is verification, because it checks whether the data was entered accurately.
The simple @ and . rule does not prove that the address is correct, deliverable, or intended.
Mark points:
- identifies the format-style email check as validation;
- identifies the double-entry match as verification.
Common weak answer:
- saying both checks are validation. Matching a repeated entry is verification, not a reasonableness check.
Answer 2: Range Check
The accepting condition is:
mark >= 0 and mark <= 100Equivalent forms such as 0 <= mark <= 100 are also correct.
Mark point:
- accepts both endpoints
0and100while rejecting values outside the range.
This answer is correct under the question’s assumption that mark is already an integer.
Common weak answer:
- using
mark > 0 and mark < 100, which rejects valid boundary marks.
Answer 3: Format Check
| Code | Valid? |
|---|---|
AB1234 | valid |
A12345 | invalid |
Ab1234 | invalid |
CD12E4 | invalid |
Reasons:
AB1234has two uppercase letters followed by four digits;A12345does not have two initial letters;Ab1234has a lowercase second letter;CD12E4has a letter in the digit section.
Mark points:
- correct judgement for each code.
Common weak answer:
- checking only the length. Length alone does not prove the character pattern is correct.
Answer 4: Presence Check
The value " " should be rejected because it contains only spaces. After removing surrounding whitespace, it is blank, so no actual student ID has been supplied.
Mark points:
- presence check ensures a required field is not blank;
- spaces-only input should be treated as blank.
Common weak answer:
- accepting the value because its length is greater than zero.
Answer 5: Check Digit
For 2462:
2 + 4 + 6 = 12
12 modulo 10 = 2The check digit is valid.
For 2463, the expected check digit is still 2, but the supplied final digit is 3, so it is invalid.
Limitation: a check digit can detect some transcription errors, but it does not prove that the code belongs to a real record or that all possible errors are detected.
Mark points:
- correct calculation for
2462; - correct rejection of
2463; - states a valid limitation.
Common weak answer:
- saying a check digit corrects all data-entry errors. It usually detects some errors; it does not guarantee correction.
Answer 6: Test Data Types
One valid set:
| Type | Values |
|---|---|
| normal | 15 |
| extreme | 13, 18 |
| abnormal | 12, 19 |
Mark points:
- gives a normal value inside the range but not at a boundary;
- gives the lower boundary;
- gives the upper boundary;
- gives an abnormal value below range;
- gives an abnormal value above range.
Common weak answer:
- calling
13abnormal. It is valid extreme data because it is on the boundary.
Answer 7: Error Type
| Code or behaviour | Error type |
|---|---|
if mark >= 50 | syntax |
average = total / count crashes when count is 0 | runtime |
if mark > 50 gives "Fail" for mark = 50, although 50 should pass | logic |
Mark points:
- syntax error for invalid Python grammar, specifically the missing colon after the condition;
- runtime error for division by zero during execution;
- logic error for code that runs but gives the wrong result.
Common weak answer:
- calling every wrong output a runtime error. A runtime error usually interrupts execution.
Answer 8: Debugging Trace
Trace:
| Iteration | n | total after assignment |
|---|---|---|
| 1 | 1 | 1 |
| 2 | 2 | 2 |
| 3 | 3 | 3 |
The logic error is that total = n replaces the previous total each time. It should accumulate:
total = total + nThe equivalent correction total += n is also valid.
Mark points:
- correct trace for first iteration;
- correct trace for second iteration;
- correct trace for third iteration;
- identifies replacement instead of accumulation.
Common weak answer:
- saying the loop runs only once. The trace shows the loop runs three times.
Answer 9: Test Plan
One valid test plan:
| Test type | Input | Expected result |
|---|---|---|
| normal valid | 50 | True |
| extreme: lower boundary | 0 | True |
| extreme: upper boundary | 100 | True |
| abnormal | 101 | False |
Mark points:
- includes one normal valid case;
- includes lower extreme value with expected result;
- includes upper extreme value with expected result;
- includes abnormal case with expected result.
Common weak answer:
- listing inputs without expected results. A test plan must say what should happen.
Answer 10: Predictable Runtime Error
For text = "abc", the conversion raises a runtime error because the program is executing but the value cannot be converted to an integer.
The specific exception to catch is ValueError.
A broad bare except is less helpful because it can hide unrelated faults. Catching ValueError makes the intended error handling clear.
Mark points:
- identifies the error as a runtime error;
- states
ValueError; - explains that catching a specific exception avoids hiding unrelated errors.
Common weak answer:
- using a bare
exceptfor all errors, which can make debugging harder.