wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

2.3 Defensive Design

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.
Which of these is not a method for ensuring a program is robust?
a)
Keeping passwords safe
b)
Data Validation
c)
Authentication
2.
Why is code indented?
a)
To group together a function
b)
The code does not use a { syntax and indentation is used instead
c)
To make it easier to read
d)
All of the above
3.
What is data validation?
a)
Checking that the data entered is wrong
b)
Checking that the data entered is correct
c)
Checking that the data entered is sensible or reasonable
4.
Which of these authentication methods is most secure?
a)
Password
b)
Password and username
c)
Key Card
d)
2 factor authentication
5.
Which is these IS NOT an example of validation?
a)
Checking the number entered is 2 digits
b)
Asking a user to type in a number
c)
Use of a Lookup table
d)
Use of a presence check
6.
What does a range check do?
a)
Checks data across a range of numbers
b)
Checks the data is within an acceptable range
c)
Sorts numbers into ascending order
d)
Checks that the data is in the correct format
7.
When a program runs it asks the user to enter their first name. Which is an example of Valid data?
a)
00000
b)
Sarah
c)
Sarah J0n3s
d)
Sarah Jones
8.
Which one of these is not a method for planning for misuse?
a)
Limiting the number of login attempts
b)
Requesting a password and user name
c)
Authentication
d)
Not validating the data entry
9.
Which is a not method of authentication?
a)
User name
b)
Password and user name
c)
Pattern Password
d)
Finger print password
10.
What is maintainability?
a)
Checking programs work
b)
Making your code easy to follow, for example, with comments
c)
Testing a program for errors
d)
Training staff to use the program correctly
11.
Which one of these is not a method for planning for misuse?
a)
Stripping unwanted characters
b)
Removing duplicated letters
c)
Converting lowercase to uppercase Letters
d)
Converting large numbers to smaller numbers.
e)
Calculating answers from formula
12.
Which of these is not a method for authenticating a user?
a)
Password
b)
Password and Username
c)
Finger print scanner
d)
Encryption
13.
Why are comments used in a program?
a)
It is required to make the program run
b)
Comments pad out the program and make it look more professional
c)
To help someone follow what is happening in your code
d)
To help security in the code
14.
When should comments be used within a program?
a)
To help describe what code and structures are expected to do
b)
To remind the developer of when lunch is
c)
To include what tests must be carried out on the code
d)
Every line, so that you know exactly what is happening
15.
What is defensive programming design?
a)
Making your code/program error free
b)
Creating code that is easy to use and understand
c)
A method of ensuring that your code is not misused
d)
Code where the data is validated
16.
A user attempts to enter in an incorrect password - what method would identify this issue?
a)
Data validation
b)
Authentication
c)
Program comments
d)
Indentation
17.
Which of the following is a bad example of a naming convention?
a)
Customer_Number
b)
custno
c)
customerNumber
d)
Cust_No
18.
A program has a section of code that covers 100 lines. What could the programmer do to keep a track of what is happening?
a)
Add more variable names to the code
b)
Use authentication
c)
Ensure they use suitable program comments
d)
Add more indentation
19.
How do sub programs improve maintainability?
a)
By returning a value
b)
Gives the program structure improving readability
c)
Carrying out a set of instructions
d)
Calling procedure name
20.
A section of a program needs a user to enter data. What two things should the programmer consider?
a)
Data validation
b)
Maintainability
c)
Input sanitisation
d)
Authentication