wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Defensive Programming Intro

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Defensive design is about ...

a)

Stopping other countries attacking your code

b)

Writing boring programs

c)

programs not breaking or doing "the wrong thing"

d)

stopping other people stealing your code

2.

The number of errors in programs can be reduced by

a)

Making your program simpler

b)

Testing thoroughly

c)

Using a bigger font

d)

Choosing a more restrictive language

3.

Whitelisting inputs means...

a)

Having a list of allowed characters

b)

Ensuring that there are "whitespace" characters in passwords

c)

Ensuring that there are no "whitespace" characters in passwords

d)

Having writing in white so it's clearer

4.

Cleaning up user's input is called

a)

validation

b)

sanitisation

c)

normalisation

d)

authentication

5.

Checking that the user is genuine is called

a)

Authorisation

b)

Validation

c)

Augmentation

d)

Authentication

6.

Logic errors mean that your program

a)

might not make sense to the user

b)

will not run

c)

will not compile

d)

might do something unexpected

7.

The best idea for testing is to

a)

write the whole program and test it at the end

b)

test a simple version and keep testing as you develop

c)

test the different parts of your program

d)

get an alpha version out ASAP and let the users loose

8.

Comments help

a)

your code run better

b)

slow down your code

c)

make your code more maintainable

d)

the computer to understand your code

9.

Which of these can help maintenance (CHOOSE ALL)

a)

indentation

b)

commenting

c)

compiling

d)

blacklisting

10.

Auto-documentation is when

a)

the computer guesses what your program does and displays it in a nice diagram

b)

you hire someone to explain your code and write a manual

c)

you rely on the program being well written and easy to read so people can tell what you mean

d)

your comments are structured so that a summary of your program can be made by an external utility