Year 11

Data validation

Year 11

Data validation

warning

These resources will be removed by end of Summer Term 2025.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

Lesson details

Key learning points

  1. In this lesson, we will develop our understanding of data validation by applying data validation through iteration.

Licence

This content is made available by Oak National Academy Limited and its partners and licensed under Oak’s terms & conditions (Collection 1), except where otherwise stated.

Loading...

3 Questions

Q1.
What will be the output when this program is executed?
An image in a quiz
Correct answer: 0, 1, 2, 3, 4
1, 2, 3, 4, 5
x, x, x, x, x
Q2.
When using the range() function. What is the first parameter used for? e.g. range(1, 11, 2)
The maximum value
Correct answer: The start value
The step or increment
The stop value
Q3.
When using the range() function. What is the second parameter used for? e.g. range(1, 11, 2)
The maximum value
The start value
The step or increment
Correct answer: The stop value

3 Questions

Q1.
If the following code was used as a validation check on, how many times could a user enter incorrect data before the program had a runtime error?
An image in a quiz
1
Correct answer: 2
There wouldn't be an error
Q2.
A user is asked to enter a number between 1 and 20. They enter 21. What type of validation error would this cause?
Empty string
It isn't an error because the value is within the specified range.
Correct answer: Out of range
ValueError
Q3.
The following code is used as a validation check to ensure that a whole number is entered. On which line will the loop terminate?
An image in a quiz
not_validated = False
number = int(input())
print("You must enter a number")
Correct answer: while not_validated: