Year 11 Exam  >  Year 11 Notes  >  Computer for GCSE/IGCSE  >  Validation

Validation | Computer for GCSE/IGCSE - Year 11 PDF Download

Introduction

  • Validation and verification ensure input data correctness, reasonableness, and accuracy.
  • Validation ensures data adherence to specified rules by programmers, while verification double-checks data for user intent.

Validation

  • Validation involves verifying input data to ensure it meets expected criteria, making it suitable for system acceptance.
  • Programmers establish rules within the code to automatically validate user input data, rejecting unreasonable entries. If rejected, users are typically provided with a message explaining the issue and given the opportunity to re-enter the data.
  • The different types of validation rules or checks are as follows:
    • Range Checks
    • Length Checks
    • Type Checks
    • Presence Checks
    • Format Checks
    • Check Digits
  • Each piece of data may require multiple different checks to be fully valid.

Range Checks

  • Range checks ensure that input data falls within a specified range defined by the user, such as a percentage between 0 and 100 or a date falling within the inclusive range of 1 to 30 for April.

OUTPUT “Enter a number between 0 and 100”
REPEAT
INPUT Number
IF Number < 0 OR Number > 100
  THEN
OUTPUT “Number is not between 0 and 100, please try again”
ENDIF
UNTIL Number >= 0 AND Number <= 100

Length Check

  • Definition: Length checks verify if input data meets specified character criteria.
  • Example: A 4-digit bank PIN must be exactly 4 characters long; otherwise, it is rejected.
  • User Prompt: Request the user to input their 4-digit bank PIN number.
  • Validation: If the length of the PIN is not 4, prompt the user to try again with a 4-character PIN.

OUTPUT “Please enter your 4 digit bank PIN number”
REPEAT
INPUT Pin
IF LENGTH(Pin) <> 4
THEN
OUTPUT “Your pin number must be four characters in length, please try again”
ENDIF
UNTIL LENGTH(Pin) = 4

  • Passwords typically have a designated length requirement, such as being between eight and twenty characters. Any password falling outside this range should be declined.

OUTPUT “Please enter a password between 8 and 20 characters”
REPEAT
INPUT Password
IF LENGTH(Password) < 8 OR LENGTH(Password) > 20
THEN
OUTPUT “Your password must be between 8 and 20 characters in length, please try again”
ENDIF
UNTIL LENGTH(Password) >= 8 AND LENGTH(Password) <= 20

Type Checks

  • Type checks verify that input data is of the correct data type. For instance, ensuring that someone's age is an integer and their name is a string.

OUTPUT “Enter an integer number”
REPEAT
INPUT Number
IF Number <> DIV(Number, 1)
  THEN
OUTPUT “Not a whole number, please try again”
ENDIF
UNTIL Number = DIV(Number , 1)

Presence Checks

  • Presence checks confirm that input data has been provided and that input fields are not left empty.
  • Systems like login authentication require presence checks for essential fields like usernames and passwords.

OUTPUT “Enter your username”
REPEAT
INPUT Username
IF Username = “”
THEN
OUTPUT “No username entered, please try again”
ENDIF
UNTIL Username <> “”

Format check

  • Format checks ensure that input data follows a specific pattern.
  • Identification codes like 'AP1234' and dates represent examples of patterns.
  • Format checks involve pattern matching and string handling processes.
  • The algorithm verifies a six-digit identification number against the format "XX9999".
  • Here, 'X' stands for an uppercase alphabetical letter and '9999' signifies a four-digit number.
  • Initial two characters are matched with a list of approved characters.
  • If a match is found, the loop stops, and the character is marked as valid.
  • Digit characters are cast into numbers for validation.
  • Validation includes checking if the digits fall within the range of 0-9999.
  • If any checks fail, the algorithm outputs an appropriate error message.

INPUT IDNumber
IF LENGTH(IDNumber) <> 6
  THEN
OUTPUT “ID number must be 6 characters long”
END IF
ValidChars ← “ABCDEFGHIJKLMNOPQRSTUVWXYZ”
FirstChar ← SUBSTRING(IDNumber, 1, 1)
ValidChar ← False
Index ← 1
WHILE Index <= LENGTH(ValidChars) AND ValidChar = False DO
IF FirstChar = ValidChars[Index]
  THEN
ValidChar ← True
ENDIF
Index ← Index + 1
ENDWHILE
IF ValidChar = False
  THEN
OUTPUT “First character is not a valid uppercase alphabetical character”
ENDIF
SecondChar ← SUBSTRING(IDNumber, 2, 2)
ValidChar ← False
Index ← 1
WHILE Index <= LENGTH(ValidChars) AND ValidChar = False DO
IF SecondChar = ValidChars[Index]
  THEN
ValidChar ← True
ENDIF
Index ← Index + 1
ENDWHILE
IF ValidChar = False
 THEN
OUTPUT “Second character is not a valid uppercase alphabetical character”
ENDIF
Digits ← INT(SUBSTRING(IDNumber, 3, 6))
IF Digits < 0000 OR Digits > 9999
  THEN
OUTPUT “Digits invalid. Enter four valid digits in the range 0000-9999”
ENDIF

Check digits

  • Check digits are single digits found at the end of codes like barcodes or ISBNs. They are calculated using a specific algorithm and are added to the code for error detection.
  • These digits play a crucial role in spotting errors that may occur during data entry, such as typing mistakes, scanning errors, or verbal slip-ups.
    • Common errors that check digits help identify include missing or extra digits, digits that are swapped, mispronounced numbers, or simply incorrect digits.

Barcode ← “9780201379624”
Total ← 0
FOR Index = 1 to LENGTH(Barcode) - 1
IF Index MOD 2 = 0
THEN
Total ← Total + CAST_TO_INT(Barcode[Index])*3
ELSE
Total ← Total + CAST_TO_INT(Barcode[Index])*1
ENDIF
NEXT Index
CheckDigit ← 10 - Total MOD 10
IF CheckDigit = Barcode[LENGTH(Barcode)]
  THEN
OUTPUT “Valid check digit”
ELSE
OUTPUT “Invalid check digit”
ENDIF

Verification

  • Verification involves ensuring that the data entered into a system is accurate. 
  • Mistakes like creating a new account or inputting a password incorrectly can lead to immediate lockout from the account.
  • Methods of verification include double entry checking and visual checks.

Double Entry Checking

  • Double entry checking requires entering data twice into separate input boxes and then comparing the entries to confirm they match. If there is a discrepancy, an error message will be displayed.

REPEAT
OUTPUT “Enter your password”
INPUT Password
OUTPUT “Please confirm your password”
INPUT ConfirmPassword
IF Password <> ConfirmPassword
THEN
OUTPUT “Passwords do not match, please try again”
ENDIF
UNTIL Password = ConfirmPassword

Visual Check

  • Visual checks entail users visually inspecting the displayed data on the screen. Following this, a popup or message prompts the user to confirm the accuracy of the data before proceeding. If incorrect, users re-enter the data.

REPEAT
OUTPUT “Enter your name”
INPUT Name
OUTPUT “Your name is: “, Name, “. Is this correct? (y/n)”
INPUT Answer
UNTIL Answer = “y”

The document Validation | Computer for GCSE/IGCSE - Year 11 is a part of the Year 11 Course Computer for GCSE/IGCSE.
All you need of Year 11 at this link: Year 11
92 docs|30 tests

Top Courses for Year 11

FAQs on Validation - Computer for GCSE/IGCSE - Year 11

1. What are validation checks in CIE IGCSE Computer Science?
Ans. Validation checks in CIE IGCSE Computer Science are used to ensure that data entered by users meets specific criteria or rules, such as range checks, format checks, and identification checks.
2. How do conditional statements help in validation in CIE IGCSE Computer Science?
Ans. Conditional statements in CIE IGCSE Computer Science allow the program to make decisions based on certain conditions, which can be used to validate user input and enforce data validation rules.
3. Why is ensuring password security important in CIE IGCSE Computer Science?
Ans. Ensuring password security is crucial in CIE IGCSE Computer Science to protect sensitive data and prevent unauthorized access to systems or accounts.
4. How does understanding data validation help in algorithm development in CIE IGCSE Computer Science?
Ans. Understanding data validation is essential in algorithm development as it ensures that the input data is accurate and meets the required criteria, leading to more reliable and efficient algorithms.
5. What are some common format checks and identification methods used in validation in CIE IGCSE Computer Science?
Ans. Common format checks include checking for the correct data type, length, and format of input data, while identification methods involve verifying the identity of users through passwords, security questions, or biometric authentication.
92 docs|30 tests
Download as PDF
Explore Courses for Year 11 exam

Top Courses for Year 11

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

shortcuts and tricks

,

past year papers

,

Viva Questions

,

Previous Year Questions with Solutions

,

Objective type Questions

,

practice quizzes

,

Validation | Computer for GCSE/IGCSE - Year 11

,

MCQs

,

Sample Paper

,

ppt

,

Free

,

Validation | Computer for GCSE/IGCSE - Year 11

,

Exam

,

pdf

,

Important questions

,

Semester Notes

,

video lectures

,

study material

,

Validation | Computer for GCSE/IGCSE - Year 11

,

Summary

,

Extra Questions

,

mock tests for examination

;