Validation Test Data
Validation Test Data
Validation and verification are two ways to check that the data entered into a computer is correct.
Data entered incorrectly is of little use.
Data verification
Verification is performed to ensure that the data entered exactly matches the original source.
Verification means checking the input data with the original data to make sure that there have
been no transcription errors (transcription means copying the data). The standard way to do this is
to input the data twice to the computer system. The computer then checks the two data values
(which should be the same) and, if they are different, the computer knows that one of the inputs is
wrong. E.g. entering password twice during sig-up. Verification methods include:
At the time of entry At the time of transmission
Double entry Parity check
Screen/visual check Checksum.
ARQ
Echo Check
Validation is an automatic computer check to ensure that the data entered is sensible and
reasonable. It does not check the accuracy of data.
For example, a secondary school student is likely to be aged between 11 and 16. The computer
can be programmed only to accept numbers between 11 and 16. This is a range check.
However, this does not guarantee that the number typed in is correct. For example, a student's
age might be 14, but if 11 are entered it will be valid but incorrect.
A validation check is a rule that is built into a database to check that the data entered is:
Sensible
Reasonable
Within acceptable boundaries
Complete
It does NOT mean that the data is actually correct, that requires verification.
There are a number of different validation rules that can be used in a database:
Type Checks - Field data types provide a basic method of validation. Field data types are
assigned to fields during the creation of the database table and data types such as Numeric,
Boolean, Date/Time and Image restrict what can be entered. If a user tries to enter text in a date
field or alphabetic characters in a numeric field, their entry will be rejected.
Range checks - these are used to limit the range of data a user can enter. The 'day' part of a date
must be in the range 1 to 31. An exam grade should be in the range 'A'...'G' or 'U'.
Presence checks - these simply check that an entry has been made in a particular field i.e. a null
value (empty field) is not permitted. Usually, not every field in a record needs to be filled in,
however there are likely to be some that must have a value and the presence check means that
the system will not allow the record to be saved until an entry is made. An application for a
passport must have the applicant's surname.
Length Checks - All alphanumeric data has a length. A single character has a length of 1 and a
string of text such as “Hello World” has a length of 11 (spaces are counted in text strings). A length
check ensures that such data is either an exact length or does not exceed a specified number of
characters. Mobile phone numbers are stored as text and should be 11 characters in length.
Lookup - A lookup check takes the value entered and compares it against a list of values in a
separate table. It can then return confirmation of the value entered or a second list based on the
value. One use of lookups restricts users to pre-defined input using drop-down lists. A user is
forced to use a list box to select from a predetermined list of valid values.
Check digits - this type of check is used with numbers. An extra 'check digit' is calculated from the
numbers to be entered and added to the end. The numbers can then be checked at any stage by
recalculating the check digit from the other numbers and seeing if it matches the one entered. One
example where a check digit is used is in the 10 digit ISBN number which uniquely identifies
books.
The last number of the ISBN is actually the check digit for the other numbers, for example - the
ISBN 0192761501.
Following two Methods are used to calculate check digit
Modulo-11 Method:
Steps Example
1. Find sum of digits at odd position
2. Find sum of digits at even position and
multiply result by 3
9 7 8 3 1 2 7 3 2 3 2 0 ?
3. Extreme Data
When testing algorithms with numerical values, sometimes only a given range of values should be
allowed. For example, percentage marks should only be in the range 0 to 100. The algorithm
should be tested with EXTREME DATA, which, in this case, are the largest and smallest marks
that should be accepted. Extreme data are the largest and smallest values that normal data can
take.
Extreme data: 0, 100
Expected results: these values should be accepted
4. Boundary Data
This is used to establish where the largest and smallest values occur. For example, for percentage
marks in the range 0 to 100, the algorithm should be tested with the following boundary data; at
each boundary two values are required, one value is accepted and the other value is rejected.
Boundary data for 0 is –1, 0
Expected results: –1 is rejected, 0 is accepted
Rogue Values
A value that stops input is called Rogue Value.
A sequence of inputs may continue until a specific value is input. This value is called a rogue
value and must be a value which would not normally arise.
A rogue value lets the computer know that a sequence of input values has come to an end.
Example: A number of marks are to be input (terminated by a rogue value of -1). How many of
them are over 50?
Counter 0
INPUT Marks
REPEAT
IF Marks >50 THEN Above50 Above50 +1
INPUT Marks
UNTIL Marks=-1
OUTPUT Above50
Example: The flowchart below inputs the weight of a number of parcels in kilograms. Parcels
weighing more than 25 kilograms are rejected. A value of –1 stops the input (a rogue
value).The following information is output: the total weight of the parcels accepted and number of
parcels rejected.
3) What validation type would you use to check that numbers fell within a certain range?
a) Range check b) Presence Check c) Check digit
5) What validation type uses the last one or two digits to check the other digits are correct?
a) Length check b) Format check c) Check digit
6) What validation type checks a minimum number of characters have been entered?
a) Length check b) Format check c) Range check
7) Data is to be entered into a computer in the format YYMMDD. Which of the following is not a valid
date?
a) 310921 b) 211113 c) 21st June 2004
patient’s height
patient ID
Contact telephone
number
Marking scheme
Field Name Name of validation check Example of data which would fail the
validation check
Date of visit Format/ type/character check e.g. 2012/12/04e.g. 3rd March 2012
Patient’s height range check/limit check can’t be < 0 or > 2.5m. e.g. –5, fivee.g. 8, -3,
Patient ID type check (can’t be < 0 or > 99999999)
length check e.g. 3142ABCDe.g. 2131451, 136498207
range check e.g. –3, 851341625
Contact telephone length check, type/character e.g. 0773141621834e.g. 7H215GD
number check, format check e.g. 01223/123456/8901234
Winter 2015 P23
4 A routine checks the age and height of children who are allowed to enter a play area. The
children must be less than 5 years of age and under 1 metre in height.
(a) The first set of test data used is age 3 and height 0.82 metres.
State what type of test data this is.
............................................................................................................................................................
Give a reason for using this test data.
............................................................................................................................................................
.......................................................................................................................................................[2]
(b) Provide two additional sets of test data. For each, give
• the type of each set of test data
• the reason why it is used
Each type of test data and reason for use must be different.
Set 1 ..................................................................................................................................................
Type ...................................................................................................................................................
Reason ..............................................................................................................................................
............................................................................................................................................................
Set 2 ..................................................................................................................................................
Type ...................................................................................................................................................
Reason ..............................................................................................................................................
....................................................................................................................................................... [6]
4 A routine checks the weight of melons to be sold in a supermarket. Melons weighing under0.5
kilograms are rejected and melons weighing over 2 kilograms are also rejected.
Give an example of each type of test data for this routine
Normal ...............................................................................................................................................
Extreme ..............................................................................................................................................
Abnormal ........................................................................................................................................[3]
Examiners Comments Question 4
Most candidates could identify at least one correct example of test data. Examples of normal and abnormal test data were usually
correct. Some candidates’ examples of extreme test data were incorrect. A correct example of extreme test data would be 0.5 or
2.0.
Winter 2016 P21-23
4 Four validation checks and four descriptions are shown below.
Draw a line to link each validation check to the correct description. [3]
Summer 16 P11, 13
9 Check digits are used to ensure the accuracy of entered data. ()
A 7-digit number has an extra digit on the right, called the check digit.
Summer 17 P21
4 For each of the four statements in the table, place a tick in the correct column to show whether it
is an example of validation or verification. [4]
Statements Validation Verification
To automatically check the accuracy of a bar code
To check if the data input is sensible
To check if the data input matches the data that has been
supplied
To automatically check that all required data fields have
been completed
Value 1 .............................................................................................................................................
Reason .............................................................................................................................................
..........................................................................................................................................................
Value 2 .............................................................................................................................................
Reason .............................................................................................................................................
......................................................................................................................................................[4]
Summer 2018 P21
4 A programmer has written a routine to check that prices are below $10.00. These values are
used as test data.
10.00 9.99 ten
Explain why each value was chosen.
10.00 .................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
9.99 ....................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
ten ......................................................................................................................................................
............................................................................................................................................................
......................................................................................................................................................[3]
(b) The programmer has also decided to validate the email address and the password.
Describe validation checks that could be used.
Email address.....................................................................................................................................
............................................................................................................................................................
...........................................................................................................................................................
Password ..........................................................................................................................................
............................................................................................................................................................
...................................................................................................................................................... [2]
Summer 18 P22
5 A program checks that the weight of a basket of fruit is over 1.00 kilograms and under1.10
kilograms. Weights are recorded to an accuracy of two decimal places and any weight not in this
form has already been rejected.
Give three weights as test data and for each weight state a reason for choosing it. All your
reasons must be different.
Weight 1.............................................................................................................................................
Reason...............................................................................................................................................
............................................................................................................................................................
Weight 2.............................................................................................................................................
Reason...............................................................................................................................................
............................................................................................................................................................
Weight 3.............................................................................................................................................
Reason...............................................................................................................................................
....................................................................................................................................................... [6]
Winter 2018 P22
2 (a) Write an algorithm, using pseudo code, to input three different numbers, multiply the two
larger numbers together and output the result. Use the variables: Number1, Number2 and
Number3 for your numbers and Answer for your result.
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
............................................................................................................................................................
....................................................................................................................................................... [5]
(b) Give two sets of test data to use with your algorithm in part (a) and explain why you chose
each set.
Test data set 1 ....................................................................................................................................
Reason ...............................................................................................................................................
............................................................................................................................................................
Test data set 2 ....................................................................................................................................
Reason ...............................................................................................................................................
.......................................................................................................................................................[4]
March 2019 P22
5 A programmer restricts input values to less than 90 and greater than 60.
(a) State whether this is called validation or verification.
...................................................................................................................................................
Name the check that needs to be used.
...................................................................................................................................................[2]
(b) State three different types of test data the programmer would need to use. Give an example of
each type and the reason that the programmer chose that test data.
Type 1 .......................................................................................................................................
Example ....................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
Type 2 .......................................................................................................................................
Example ....................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................
Type 3 .......................................................................................................................................
Example ....................................................................................................................................
Reason .....................................................................................................................................
...................................................................................................................................................[9]
Q 12.83 Summer2019 P22
5 Explain what is meant by validation and verification.
Give an example for each one.
Validation ..........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Example ...........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Verification ........................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
..........................................................................................................................................................
Example ...........................................................................................................................................
..........................................................................................................................................................
...................................................................................................................................................... [6]
Summer2019 P21
4 This section of program code may be used as a validation check.
1 PRINT "Input a value between 0 and 100 inclusive"
2 INPUT Value
3 WHILE Value < 0 OR Value > 100
4 PRINT "Invalid value, try again"
5 INPUT Value
6 ENDWHILE
7 PRINT "Accepted: ", Value
(a) Give a name for this type of validation check.
............................................................................................................................................. [1]
(b) Describe what is happening in this validation check.
.............................................................................................................................................................
.............................................................................................................................................................
.............................................................................................................................................................
.............................................................................................................................................................
................................................................................................................................................... [2] (
c) Complete the trace table for this program code using the test data: 200, 300, –1, 50, 60[3]
Value OUTPUT
Complete a trace table for each of the two sets of input data.
Set 1 5, 2, 4, 3, 1, 5
Set 2 3, 2, 1, 0, 7, 3
Trace table set 1: 5, 2, 4, 3, 1, 5