Data Validation Quiz

When programming a computer system, it is good practice to include a range of validation checks in the code to check if the data being inputted by the end-user follows some basic rules.

The aim of validation checks is to ensure that data used or stored by computer systems is valid. Invalid data may indeed make the system crash or may provide inaccurate information back to the user.

Validation checks cannot confirm if the data is correct or not but they can filter out a lot of invalid data.

There are different types of checks that can be implemented in your code such as:

  • Presence Check: When a field has to be filled in (mandatory field) and cannot be left blank/empty. (e.g username field when you sign in to a new system)
  • Length Check: When a field has to contain a set number of characters (e.g. a password is at least 8 characters long, a credit card number contains 16 digits).
  • Type Check: When a field has be of a certain data type (integer, float/real, etc.).
  • Range Check: When a field has be within a range, or greater or lower than given value. (e.g. A percentage value has to be between 0 and 100)
  • Lookup Check: When a field can only accept a certain set of values from a list (e.g. A title field can be either Mr, Mrs, Ms or Dr)
  • Character Check: When a field has to contain a specific character or type of characters. (e.g. An e-mail address should contain an “@” sign)

Take the Quiz! (open full screen)


Check that you understand the different types of validation checks by completing this quiz:

Did you like this challenge?

Click on a star to rate it!

Average rating 4 / 5. Vote count: 66

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: