Chapter 7 Algorithm Design And Problem Solving: Unit 7.5: Validation And Verification Flashcards
Describe validation.
Ensures that only data that is reasonable is accepted by program.
What are the 6 validation checks?
Range checks
Length checks
Type checks
Presence checks
Format checks
Check digits
Describe range check.
Checks that the value of a number is between an upper value and a lower value.
Example:
OUTPUT “Please enter the student’s mark “
REPEAT
INPUT 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
Describe length check.
Checks either:
That data contains an exact number of characters
Example:
OUTPUT “Please enter your password of eight characters “
REPEAT
INPUT Password
IF LENGTH(Password) <> 8
THEN
OUTPUT “Your password must be exactly eight characters, please re-enter “
ENDIF
UNTIL LENGTH(Password) = 8
Or that the data entered is a reasonable number of characters
Example:
OUTPUT “Please enter your family name “
REPEAT
INPUT FamilyName
IF LENGTH(FamilyName) > 30 OR LENGTH(FamilyName) < 2
THEN
OUTPUT “Too short or too long, please re-enter “
ENDIF
UNTIL LENGTH(FamilyName) <= 30 AND LENGTH(FamilyName) >= 2
Describe type check.
Checks that the data entered is of a given data type.
Example:
OUTPUT “How many brothers do you have? “
REPEAT
INPUT NumberOfBrothers
IF NumberOfBrothers <> DIV(NumberOfBrothers, 1)
THEN
OUTPUT “This must be a whole number, please re-enter “
ENDIF
UNTIL NumberOfBrothers = DIV(NumberOfBrothers, 1)
Describe presence check.
Checks to ensure that some data has been entered and the value has not been left blank.
Example:
OUTPUT “Please enter your email address “
REPEAT
INPUT EmailAddress
IF EmailAddress = “ “
THEN
OUTPUT “*=Required”
ENDIF
UNTIL EmailAddress <> “ “
Describe format check.
Checks that the characters entered conform to a pre-defined pattern.
Describe check digits.
The final digit included in a code; it is calculated from all the other digits in the code. Can usually identify errors such as:
An incorrect digit entered
Transposition errors where two numbers have changed order
Omitted or extra digits
Phonetic errors
Describe verification.
Checks that data has been accurately copied from one source to another.
What are the 2 verification methods for input data?
Double entry
Screen/visual check
Describe double entry.
The data is entered twice. The computer compares both entries and if they are different outputs an error message requesting that the data is entered again.
Describe screen/visual check.
Manual check completed by a user who is entering the data. When the data entry is complete the data is displayed on the screen and the user is asked to confirm that it is correct before continuing.