A robust program works correctly across a wide range of inputs, including unexpected or invalid ones, and handles errors gracefully without crashing. Robustness is achieved through input validation, error handling (exception handling), and thorough testing.
Validation checks that data entered by a user is acceptable — within the right range, type, and format — before the program uses it. It does not check whether data is true (that is verification).
| Validation type | What it checks | Example |
|---|---|---|
| Range check | Value is within permitted limits | Age between 0 and 120 |
| Type check | Data is the correct data type | Score must be an integer |
| Presence check | A required field is not empty | Name field cannot be blank |
| Length check | String is the right length | PIN must be exactly 4 digits |
| Format check | Data matches a required pattern | Date is DD/MM/YYYY |
Authentication is the process of verifying the identity of a user. It ensures only authorised users can access a system.
| Method | Description | Example |
|---|---|---|
| Username & password | User knows a secret | Login to a website |
| Biometrics | User's physical feature | Fingerprint, Face ID |
| Two-factor (2FA) | Two separate checks combined | Password + SMS code |
Testing is checking that a program behaves correctly. Good testing uses a range of test data covering all categories of input.
| Test data type | Description | Example (age 0–120) |
|---|---|---|
| Normal | Typical, expected input within range | 25, 40, 70 |
| Boundary | Values at the edge of the valid range | 0, 1, 119, 120 |
| Erroneous | Invalid data the program should reject | -1, 121, "hello", 200 |
Most programming errors occur at the boundary — e.g., using < instead of <= means the boundary value (120) is incorrectly rejected. Always test both sides of a boundary.
| Type | When? | What is tested? |
|---|---|---|
| Iterative testing | During development | Each module/subroutine as it is written |
| Final (terminal) testing | After all modules are complete | Whole program, end-to-end |
8 questions · 22 marks
| Term | Definition |
|---|
Timed exam conditions.