Font size
Worksheets2.3 Robust Programs
Total questions: 25
Worksheet time: 15mins
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)
Defensive design is contigency planning using validation, sanitisation, authetication, maintenance and tesing.
What is validation?
checking an input is sensible and possible
cleaning up input data
checking the user is who they say they are
using sensible variable names, comments and indentation
Running the program with various test data to remove bugs
Defensive design is contigency planning using validation, sanitisation, authetication, maintenance and tesing.
What is input sanitisation?
checking an input is sensible and possible
cleaning up input data
checking the user is who they say they are
using sensible variable names, comments and indentation
Running the program with various test data to remove bugs
Defensive design is contigency planning using validation, sanitisation, authetication, maintenance and tesing.
What is input authentication?
checking an input is sensible and possible
cleaning up input data
checking the user is who they say they are
using sensible variable names, comments and indentation
Running the program with various test data to remove bugs
Defensive design is contigency planning using validation, sanitisation, authetication, maintenance and tesing.
What does writing well maintained code involve?
checking an input is sensible and possible
cleaning up input data
checking the user is who they say they are
using sensible variable names, comments and indentation
Running the program with various test data to remove bugs
Defensive design is contigency planning using validation, sanitisation, authetication, maintenance and tesing.
What is testing?
checking an input is sensible and possible
cleaning up input data
checking the user is who they say they are
using sensible variable names, comments and indentation
Running the program with various test data to remove bugs
Which is the descriptor for presence check?
Numbers between two given values are accepted
Data is of a particular specified type
Data contains an exact number of characters
Ensures that some data has been entered
Which is the descriptor for range check?
Numbers between two given values are accepted
Data is of a particular specified type
Data contains an exact number of characters
Ensures that some data has been entered
Which is the descriptor for type check?
Numbers between two given values are accepted
Data is of a particular specified type
Data contains an exact number of characters
Ensures that some data has been entered
Which is the descriptor for length check?
Numbers between two given values are accepted
Data is of a particular specified type
Data contains an exact number of characters
Ensures that some data has been entered
What will this code display?
pass
fail
nothing because there will be a syntax error
passfail
What programming construct does this code contain?
selection
iteration
just sequence, there is no selection or iteration.
The code should be indented. Which lines should be indented.
if a>=6:
print("pass")
else:
print("fail")
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?
assessment score
as
assessment_score
AssessmentScore
There are two types of error that can occur within a program. What are they?
syntax error
extreme error
erroneous error
logic error
valid error
A syntax error...
(choose 2 answers)
will stop the program from running
will cause the program to run in an unexpected manner
is when the code does not follow the rules of the programming language
is when the programmer hasnt written the instructions well, so the prorgam doesnt perform correctly.
A logic error...
(choose 2 answers)
will stop the program from running
will cause the program to run in an unexpected manner
is when the code does not follow the rules of the programming language
is when the programmer hasnt written the instructions well, so the prorgam doesnt perform correctly.
Iterative testing...
is where the programmer writes a module, tests it, fixes the errors then retests the module before writing the next.
is where all the modules are written then the full code is tested once the program is complete.
Final testing...
is where the programmer writes a module, tests it, fixes the errors then retests the module before writing the next.
is where all the modules are written then the full code is tested once the program is complete.
Three types of test data should be used when testing a program. What are the 3 types of test data?
valid data
syntax data
extreme data
erroneous data
iterative data
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?
1
10
4
12
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?
1
10
4
12
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?
1
10
4
12
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?
function
variable
procedure
selection
A function...
performs a specific tasks then returns a value to the main program.
performs a specific task then ends.
