Validating inputs prevents the user from accidentally or intentionally misusing a program.
Table 1 shows the five main types of validation checks.
Table 1
| Check | Description |
|---|---|
| Range check | Checks whether the input (usually numerical or date) is within a given range |
| Type check | Checks whether the input is of the correct data type (integer, string, real, etc.) |
| Length check | Checks the length of the input (e.g. longer than 8 characters) |
| Presence check | Checks that the input has not been left blank |
| Format check | Checks the format of the input (e.g. email address must contain '@') |
Authentication is the process of checking that a particular user is permitted to use a system and, if so, which parts of that system they can use.
(i.e., authentication makes sure that a person is actually who they say they are)
A common example of an authentication measure is the username/password combination.
A website wants to only accept usernames which are 5 to 10 characters and start with a letter.
Which two validation checks would they need to use?
Tap/click to reveal
Length check to make sure it's 5 to 10 characters
Format check to make sure it starts with a letter