verification and validation · verification and validation checks. verification verification is a...

Post on 05-Aug-2020

34 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Verificationand

Validation checks

Verification

▪ Verification is a way of preventing errors when data is

copied from paper documents to the computer.

▪ There two ways in which verification can be done:

1. Double Entry

2. Visual check

Verification methods

Two Verification methods:

1. Double Entry

2. Visual check

Double Entry

In the double entry verification method:

▪ data is entered twice

▪ the data is accepted only if both

versions match up.

Double entry verification method is used

when creating or modifying passwords

The user is asked to type the password

twice.

Visual check

In the visual check verification method:

•Errors are spotted by comparing data entered

into the computer with data on the original

document

•This ensures that whatever is on the screen is the

same as that on paper

Validation Checks

▪Validation is a process of checking if data

satisfies certain criteria when input

▪To be accepted the input data must be correct

and reasonable

▪The checking is done by a computer program.

Validation Checks

Computer program to validate quantity sold

Input quantitySold

IF (quantitySold <= 0) THEN

message(“Invalid quantity”)

ELSE

message(“quantity accepted”)

END IF

Validation Checks

▪ Input data can be validated in several ways

▪Different types of check may be used on the same data item

▪ E.g. When entering “Quantity Sold”

▪we may check that the value entered:

▪ Is greater than zero

▪ Is a number (not a letter / character)

▪ Is not more than quantity in stock

▪ Each type of validation check is given a name.

Range check

▪ Range Check ensures that only numbers within a

specified range are accepted

▪ Example : Exam marks for a student cannot be less

than zero AND more than 100

▪ i.e. the acceptable range is 0 to 100

Length check

▪ A Length Check ensures that the data entered contains the

exact number of characters

▪ Examples :

▪ Student Bus Pass number must contain exactly 10 characters

▪ National ID number must contain exactly 14 characters

▪ If less or more characters are entered the program rejects the

input as it is incorrect.

Type check

▪ A Type Check ensures that the data entered is of the

correct data type

▪ Remember data types learnt in programming classes (Integer, Double, String, Date, Boolean )

▪ Examples :

▪ Quantity Sold must be a whole number (integer)▪ Price may be a decimal number (double)▪ Name must contain alphabetical characters only (string)

Character check

▪A Character Check ensures that data entered

contains only characters of the correct type

▪For example check that :

▪ There are no letters in a numeric field

▪ e.g. studentMarks = xyz (invalid marks)

Format Check

▪ Ensures that the data being entered is in the correct format

▪ i.e. the data must follow a pre-defined pattern

▪ e.g. a program requires date to be input as DD/MM/YYYY

▪Will the program accept or reject the following entries?

▪Date = 14/6/19

▪Date = 04/05/2019

▪Date = 24-12-2019

▪Date = 24/JAN/2019 Check your answers

Format Check

▪Date format = DD/MM/YYYY

▪Will the program accept or reject the following entries?

• Date = 14/6/19

• Date = 04/05/2019

• Date = 24-12-2019

• Date = 24/JAN/2019

Reject

Accept

Reject

Reject

Presence Check

▪Checks to ensure that some required data has been

entered and the value has not been left blank

▪E.g. When a login is being performed, password must

be entered.

▪I.e. the program will not proceed if password field is left

blank.

Check Digit

•A digit that is calculated from the data

▪Calculation uses modulo method

•Calculated digit is appended (added) to the data

•Computer recalculates check digit when data is entered

•Original digit and calculated are compared

▪If digits match then data has been entered correctly (accept)

▪Else incorrect data has been entered (reject/enter again)

16

Check Digit

• Check digits are used to identify errors in data entry caused by mistyping

or scanning damaged barcodes.

• Errors that can be detected by check digit method:

• (1) digits have been transposed (inverted)

▪e.g. instead of 1 2 3 4 5 user enters 1 2 4 3 5

• (2) an incorrect digit has been entered

▪e.g. instead of 1 2 3 4 5 user enters 1 2 3 3 5

• (3) a digit is completely missed out

▪e.g. instead of 1 2 3 4 5 user enters 1 3 4 5

Homework 11. Describe, giving an example the purpose of the following checks during data entry.

(a)Validation check

Description: ........................................................................................................................................................................

Example: .............................................................................................................................................................................

(b)Verification check

Description: ........................................................................................................................................................................

Example: .............................................................................................................................................................................

2. An ISBN (book number) has a check digit.

(i) Explain how the check digit is used as a validation check.

............................................................................................................................. ...............................................................

(ii) Describe two types of errors can the check digit identify?

............................................................................................................................. ...............................................................

............................................................................................................................. ...............................................................

Homework 2

Homework 3

Homework 4A program has been written to process student marks in a set of tests.

(a) Describe two validation checks that could be made on a student name.

1 ........................................................................................................................... ............

............................................................................................................................. .............

2 ........................................................................................................................... ............

............................................................................................................................. ..............

(b) Describe two validation checks that could be made on a mark.

1 ........................................................................................................................... ............

............................................................................................................................. .............

2 ........................................................................................................................... ............

............................................................................................................................. ..............

top related