Validation and verification Cambridge IGCSE Computer Science (9–1) revision

Not started

Learn it

In plain words

Rubbish in, rubbish out. A program that accepts an age of 250 or a blank name will produce nonsense, so data is checked as it is entered. There are two kinds of check, and they answer different questions.

Validation asks: is this data sensible? Verification asks: is this what was meant to be typed?

6 things to know

  1. Validation is an automatic check by the program that data is reasonable and follows the rules, before it is accepted.
  2. Range check: the value lies between two limits. Length check: it has the right number of characters. Type check: it is the right kind of data, such as a number.
  3. Presence check: something has been entered, and the field is not left empty. Format check: it follows a pattern, such as two letters and then four digits. Check digit: the extra digit calculated from the others matches.
  4. Validation cannot tell whether data is correct. An age of 61 typed for a 16-year-old passes a range check.
  5. Verification checks that data has been copied accurately from its source.
  6. Visual check: the user reads what was entered and compares it with the original. Double entry check: the data is entered twice, and the two versions are compared.

Worked example

A form asks for a PIN that must be exactly four digits. Which validation checks should be used?

  1. Something must be entered: a presence check.
  2. It must be made of digits only: a type check.
  3. It must have exactly four characters: a length check.

Tips and tricks

  • Validation: is it reasonable? Verification: was it copied correctly? Neither proves the data is true.
  • Name the check and say what it tests, using the data in the question: "a range check, so that the mark is between 0 and 100".
6 questions, about 2 minutes.

It lands in your notebook with its questions as flashcards.

Validation and verification: 6 questions and answers

These are the quiz’s questions. Do the quiz first, then come back here for the ones that got you.

  1. Which check makes sure a mark is between 0 and 100?
    • range check (the answer)
    • length check
    • presence check
    • format check

    It tests against a lower and an upper limit.

  2. Which check makes sure a field has not been left empty?
    • range check
    • type check
    • presence check (the answer)
    • check digit

    Something must be present.

  3. Which check would make sure a code is two letters followed by three digits?
    • range check
    • presence check
    • length check
    • format check (the answer)

    It tests the pattern of the characters.

  4. Which of these is a verification check?
    • range check
    • type check
    • double entry check (the answer)
    • length check

    The data is typed twice and the two are compared.

  5. A user is asked to type a new password twice. This is:
    • a range check
    • a double entry check (the answer)
    • a format check
    • a check digit

    The two entries are compared.

  6. A 16-year-old types her age as 61. The program accepts ages from 11 to 99. Why is the mistake not caught?Stretch
    • The program has no validation.
    • Validation only checks that data is reasonable, not that it is correct. (the answer)
    • 61 is not a number.
    • Range checks only work on text.

    61 is inside the range, so it passes.

Still stuck on this one?Ask in the Papermunch Discord, or help someone else who is. Discord is for ages 13 and up.Join the server

Things you can type

Or go straight to

Or browse a shelf