wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Defensive Design/ Robust Coding

Total questions: 10

Worksheet time: 7mins

Name
Class
Date
1.

Which of the following is an example of data verification?

a)

Checking the data is of the correct type

b)

Asking the user to type in the password twice

c)

Checking that the password contains letters and numbers

d)

Checking that the data is of the correct length

2.

What kind of test will ensure that the user types an appropriate number when asked for their age?

a)

Data type check

b)

Data length check

c)

Data range check

d)

Asking them to type in their age twice

3.

Which of the following statements is true?

a)

Data validation cannot tell you if the answers are correct

b)

Data validation cannot check if a password is in the right format

c)

Data validation cannot tell you if the answer is a date

d)

Data validation can prevent logic errors

4.

A (a)   error is when you have spelt a key word incorrectly, used the wrong capitalisation, missed out or placed punctuation in the wrong place.

5.

If your program does not display any error messages but behaves in an unexpected way, you probably have a ----- error.

(a)  

6.

Which of these is likely to be a result of a logic error in your program?

a)

You get an error message because you typed a letter when asked how old you were

b)

You used the wrong capitalisation for the print() command

c)

You forgot to type a colon at the end of your function definition

d)

Your program enters an infinite loop

7.

A syntax error could be caused by which of these?

a)

Your if statement had a < symbol when you should have used a > symbol

b)

Your if statement used = instead of == to compare two values

c)

Your if statement used != instead of == to compare two values

d)

You typed 'while x >20' when you meant to write 'while x<20'

8.

If you make sure that the user typed in data accurately by asking them to type it in twice or asking two different people to answer the same question and comparing the two inputs this is called data (a)  

9.

Making sure that the answer is entered in the correct format, length or data type is data (a)   .

10.

If you check that the date of birth is not in the future or more than 150 years ago, this is called (Select ALL correct options)

a)

Data verification

b)

Data validation

c)

Data length check

d)

Data range check