You are on page 1of 7

Validation and verification checks

Objectives: Student should be able to -


 describe what is meant by validation and verification.
 state when it is appropriate to use validation.
 state when it is appropriate to use verification.
 describe with example the type of validation, like -
1. Range check
2. Length check
3. Type check
4. Presence check
5. Format check
6. Check digit

Q1. a) Describe what is meant by validation and verification.

Validation:
 Validation is an automatic check performed by a program to ensure that the data entered is
sensible and reasonable before it is accepted by the system.
 Validation check is assigned to a data field by giving appropriate field attributes and
validation rules.
 It does not check the accuracy of data
Example: Presence check, type check, range check, format check etc.

Verification:
 Verification is a process performed to ensure that the data entered into a computer or
transferred from one system to another exactly matches with the original data.
 Verification is done either manually by visual check called Proof-reading or automatically by
software called Double-entry method, where the same data is entered twice and the two
copies are compared with each other.
 During data transmission, verification is done automatically by software using different error
detection methods.
Example: Proof-reading, Double-entry method, Parity check, Checksum, echo check etc.

CS 2210/ 0478 Page 1 of 7


b) Tick (✓) one box in each row to identify if the statement is about validation,
verification or both.

Validation Verification Both


Statement
(✓) (✓) (✓)

Entering the data twice to check if both entries



are the same.
Automatically checking that only numeric data has

been entered.
Checking data entered into a computer system

before it is stored or processed.
Visually checking that no errors have been ✓
introduced during data entry.

c) Give difference between data Validation and Verification.

Data Validation Data Verification


Validation is an automatic computer Verification is done either manually by Proof-
check, done while entering data into reading or by entering the same data twice
the computer against the set validation and comparing the two copies by computer,
rules. using software.

It ensures that the data entered is sensible


It ensures that the data entered exactly matches
and reasonable, but does not check its
the original source.
accuracy.

Validation is done before data is


Verification is done after data is entered into the
accepted and stored in computer.
computer.

CS 2210/ 0478 Page 2 of 7


Q2. Validation and verification checks are used on values that are input into a computer
program.
a) (i) State when it is appropriate to use validation.

It is used when we need to ensure that the data entered is sensible, reasonable and consistent;
accepted only if it falls within the set rules. It does not check the accuracy of data.

(ii) State when it is appropriate to use verification.

It is used when we need to ensure that the data entered exactly matches the original source. It
is done by either proof reading or double entry method.

b) (i) Give two examples of validation checks.


1. Range check – to ensure that a number falls within the specified range of values.
2. Length check – to ensure that the data isn’t too short or too long.
3. Type check – to ensure the correct type of data like, text, number or date.
4. Presence check – to ensure that the data has been entered into a field.
5. Format check – to ensure that the data is in right format.
6. Check digit – the last one digit in a code (number) is used to check that the other
digits are correct.

(ii) Give two examples of verification checks.


1. Proof reading / screen or visual check – checking the data entered against the original
source visually by someone.
2. Double entry – entering data twice and comparing the two copies using software.

CS 2210/ 0478 Page 3 of 7


Q3. Validation check is assigned to a data field by giving appropriate field attributes and
validation rules to check its integrity.

Describe the following how the following Validation check works and give an example
of its usage.

Validation How it works Example of its usage


type
In most databases a key field cannot
Presence Checks that the data has been entered
be left blank. (i.e., Field cannot be
check into a field.
left blank).

Name (Text), Date of birth


Checks that the data entered is of an
(Date),
Type check expected type, e.g., text, a number,
Age (Number), Sex (Boolean), Price
date ... etc.,
(Currency).

A Passport number is in the form


Format Checks that the data is in the right L9999999, where L is any letter and 9
check format. is any number.
Example: M5228907

Like "dd/mm/yyyy" or
Date
Checks that the data is in the right "dd.mmm.yyyy"
Format
'Date' format. Example : 24/03/1968 or 24
check
Mar.1968

Length Checks that the data isn't too short A Password which needs to be
check or too long. minimum six letters long.

List check
(or) Checks that the data is in the List or List of subjects of a particular
Look up Table. grade.
table

Range Checks that a value falls within the Student’s Marks mush be -
check specified range. “Between 0 and 100”

Bar code readers in supermarkets use


The last one digit in a code (number) check digits to check the number read
Check digit is used to check that the other digits is correct and match with check digit.
are correct.

CS 2210/ 0478 Page 4 of 7


Consistence
Checks that different fields in the If ‘Mr’ has been entered into the title
(or)
same record correspond correctly. field, ‘Male’ must be entered into the
Cross-field
gender field.
check

Checking the spelling for a word while


Spell check Looks up words in a dictionary.
typing.

Q4. A programmer has written a routine to store the name, email address and
password of a contributor to a website’s discussion group.

a) The programmer has chosen to verify the name, email address and
password.
Explain why verification was chosen and describe how the programmer would verify this
data.

 To ensure the accuracy of input data; make sure that they entered the data what they
intended, without mistake.
 The programmer could ask the contributor to type in each detail twice and then check that
both values are equal. If they are not equal then the input should be rejected.

b) The programmer has also decided to validate the email address and the password.
Describe validation checks that could be used for –

Email address-
 Format check - to check for @ symbol that separates the mail address and domain
name / no space is allowed (white or blank).
 Uniqueness check - to check and ensure that it should not match with other's email
address.
 Length check - to check and ensure that it should not contain more than 254 characters.
Password-
 Length check - to check if its length is minimum 8 characters.
 Format check - to check if it contains a mixture of lower and upper-case letters, at least
one digit (0 to 9) and one special character or symbol.
 Presence check - to ensure that the field should not be left empty.

CS 2210/ 0478 Page 5 of 7


Q5. State, with reasons, which validation and verification checks you could use for the
following inputs.
 Entering a telephone number
 Entering a pupil's name
 Entering a part number in the form XXX999, when X must be a letter and 9
must be a digit.

Telephone number-
 Length or Range check - validation to check if the number contains 7-digits; must be
between 1000000 and 9999999.
 Check digit - verification to ensure the accuracy of input data; the last one digit of the
number is used to check that the other digits are correct.

Pupil's name
 Length check - validation to check if the length of name is less than or equal to 30
characters.
 Visual check - verification to ensure the accuracy of input data; ask the user to check the
name displayed on screen and confirm that it is correct.
Part number
 Format check - validation to check if the input data is in appropriate format with 3
characters and 3 digits.
 Double-entry - verification to ensure the accuracy of input data; ask the user to type in the
number twice and then check that both the values are equal.

Q6. Write a pseudocode algorithm using pseudocode for range check validation to be used
on entry of marks. If the input mark is out of range between 0 and 100 (inclusive), then
produce an error message and ask to re-enter the mark.

REPEAT
INPUT "Enter the student's mark - ", StudentMark

IF (StudentMark < 0 OR StudentMark > 100) THEN


OUTPUT "The student's mark should be in the range 0 to 100, please re-
enter the mark"
ENDIF
UNTIL (StudentMark >= 0 AND StudentMark <= 100)

CS 2210/ 0478 Page 6 of 7


Q7. Write an algorithm using pseudocode for length check validation to be used on entry of
password, to check if its length is between 8 and 12 characters inclusive. If its length is less
than 8 or above 12 characters, then it should be rejected with error message.

REPEAT
INPUT "Enter the password between 8 and 12 characters in length - ", Password

IF (LENGTH(Password) < 8 OR LENGTH(Password) > 12) THEN


OUTPUT "Invalid, your password should be between 8 and 12 characters in length.
Please re-enter the mark."
ENDIF
UNTIL (LENGTH(Password) >= 8 AND LENGTH(Password) <= 12)

Q8. Write an algorithm using pseudocode for type check validation to be used on entry of
mark, to check if it is in whole number (data type, integer). If it is in decimal (data type,
real), then it should be rejected with error message.

REPEAT
INPUT "Enter the mark in whole number - ", Mark

IF Mark < > DIV(Mark, 1) THEN


OUTPUT "Invalid, mark must be in whole number. Please re-enter the mark."
ENDIF
UNTIL Mark = DIV(Mark, 1)

Q9. Write an algorithm using pseudocode for presence check validation to be used on entry
of student ID, to check that some data has been entered and the value has not been left
blank. If it is left blank, then it should be rejected with error message.

REPEAT
INPUT "Enter the student's ID - ", StdID

IF StdID = " " THEN


OUTPUT "Sorry, student's ID cannot be left blank. Please re-enter the student's
ID."
ENDIF
UNTIL StdID < > " "

CS 2210/ 0478 Page 7 of 7

You might also like