wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

2.3 Robust Programs

Total questions: 25

Worksheet time: 15mins

Name
Class
Date
1.

Computer programs should be designed to ​ (a)   with unexpected or erroneous input from users.

Coders should ​ (b)   for all contingencies that might occur (accidental and ​ (c)   inputs)

Choose from the below words
cope
plan
deliberate
handle
consider
2.

Defensive design is contigency planning using validation, sanitisation, authetication, maintenance and tesing.

What is validation?

a)

checking an input is sensible and possible

b)

cleaning up input data

c)

checking the user is who they say they are

d)

using sensible variable names, comments and indentation

e)

Running the program with various test data to remove bugs

3.

Defensive design is contigency planning using validation, sanitisation, authetication, maintenance and tesing.

What is input sanitisation?

a)

checking an input is sensible and possible

b)

cleaning up input data

c)

checking the user is who they say they are

d)

using sensible variable names, comments and indentation

e)

Running the program with various test data to remove bugs

4.

Defensive design is contigency planning using validation, sanitisation, authetication, maintenance and tesing.

What is input authentication?

a)

checking an input is sensible and possible

b)

cleaning up input data

c)

checking the user is who they say they are

d)

using sensible variable names, comments and indentation

e)

Running the program with various test data to remove bugs

5.

Defensive design is contigency planning using validation, sanitisation, authetication, maintenance and tesing.

What does writing well maintained code involve?

a)

checking an input is sensible and possible

b)

cleaning up input data

c)

checking the user is who they say they are

d)

using sensible variable names, comments and indentation

e)

Running the program with various test data to remove bugs

6.

Defensive design is contigency planning using validation, sanitisation, authetication, maintenance and tesing.

What is testing?

a)

checking an input is sensible and possible

b)

cleaning up input data

c)

checking the user is who they say they are

d)

using sensible variable names, comments and indentation

e)

Running the program with various test data to remove bugs

7.

Which is the descriptor for presence check?

a)

Numbers between two given values are accepted

b)

Data is of a particular specified type

c)

Data contains an exact number of characters

d)

Ensures that some data has been entered

8.

Which is the descriptor for range check?

a)

Numbers between two given values are accepted

b)

Data is of a particular specified type

c)

Data contains an exact number of characters

d)

Ensures that some data has been entered

9.

Which is the descriptor for type check?

a)

Numbers between two given values are accepted

b)

Data is of a particular specified type

c)

Data contains an exact number of characters

d)

Ensures that some data has been entered

10.

Which is the descriptor for length check?

a)

Numbers between two given values are accepted

b)

Data is of a particular specified type

c)

Data contains an exact number of characters

d)

Ensures that some data has been entered

11.

What will this code display?

a)

pass

b)

fail

c)

nothing because there will be a syntax error

d)

passfail

12.

What programming construct does this code contain?

a)

selection

b)

iteration

c)

just sequence, there is no selection or iteration.

13.

The code should be indented. Which lines should be indented.

a)

if a>=6:

b)

print("pass")

c)

else:

d)

print("fail")

14.

This code stores the result of an assessment, then outputs whether this is a pass or fail. What would be a more suitable variable name?

a)

assessment score

b)

as

c)

assessment_score

d)

AssessmentScore

15.

There are two types of error that can occur within a program. What are they?

a)

syntax error

b)

extreme error

c)

erroneous error

d)

logic error

e)

valid error

16.

A syntax error...

(choose 2 answers)

a)

will stop the program from running

b)

will cause the program to run in an unexpected manner

c)

is when the code does not follow the rules of the programming language

d)

is when the programmer hasnt written the instructions well, so the prorgam doesnt perform correctly.

17.

A logic error...

(choose 2 answers)

a)

will stop the program from running

b)

will cause the program to run in an unexpected manner

c)

is when the code does not follow the rules of the programming language

d)

is when the programmer hasnt written the instructions well, so the prorgam doesnt perform correctly.

18.

Iterative testing...

a)

is where the programmer writes a module, tests it, fixes the errors then retests the module before writing the next.

b)

is where all the modules are written then the full code is tested once the program is complete.

19.

Final testing...

a)

is where the programmer writes a module, tests it, fixes the errors then retests the module before writing the next.

b)

is where all the modules are written then the full code is tested once the program is complete.

20.

Three types of test data should be used when testing a program. What are the 3 types of test data?

a)

valid data

b)

syntax data

c)

extreme data

d)

erroneous data

e)

iterative data

21.

This code asks the user to enter a number between 1 and 10.

The program is to be tested with valid, extreme and erroneous data. Which of the below would be classed as valid data?

a)

1

b)

10

c)

4

d)

12

22.

This code asks the user to enter a number between 1 and 10.

The program is to be tested with valid, extreme and erroneous data. Which of the below would be classed as exteme data?

a)

1

b)

10

c)

4

d)

12

23.

This code asks the user to enter a number between 1 and 10.

The program is to be tested with valid, extreme and erroneous data. Which of the below would be classed as erroneous data?

a)

1

b)

10

c)

4

d)

12

24.

Subrprograms are named blocks of code that can be called/accessed by the main program. What are the names of the two types of subprogram?

a)

function

b)

variable

c)

procedure

d)

selection

25.

A function...

a)

performs a specific tasks then returns a value to the main program.

b)

performs a specific task then ends.