1/22
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is defensive design?
What are two key aspects of defensive design?
Anticipating misuse → considering how users may misuse a program + thus ensuring that it caters to all likely inputs
Authentication → confirms identity of user to ensure only authorised users can gain access to a system
What is input validation?
The process of checking whether and ensuring input data meets a certain criteria.
What is the difference between input validation and verification?
Validation checks whether the input data meets a certain criteria, while verification checks whether data is accurate or correct.
What are some examples of input validation?
Presence check
Type check
Range check
Format check
Length check
How can input validation be implemented in code?
EX: presence check
name = input("Enter your name: "):
while name == "":
print("Name cannot be empty.")EX: range check
age = input("Enter your age: "):
while age < 0 and age > 120:
print("Age must be between 0 and 120")What is maintainability?
The ease of understanding, modifying and updating a program.
What are 4 ways maintainability can be improved?
Subprograms
Appropriate variable names
Indentation
Comments
How does using subprograms improve maintainability?
It allows blocks of code to be reused and individually tested.
How does using appropriate variable names improve maintainability?
It ensures that the purpose of the variable is immediately understood.
How does using indentation improve maintainability?
It improves readability, makes it easier to identify block of code and find errors.
How does commenting improve maintainability?
It explains the purpose of each line of code.
What is the purpose of testing?
To identify (and fix) errors in a program in order to ensure that it runs correctly.
What are the two types of testing?
Iterative
Final/terminal
What is the difference between iterative and final/terminal testing?
Iterative testing is the process of testing different modules of program during its development, whereas terminal testing is the process of testing the program at the end of its development.
What are the two key types of programming error?
Syntax error
Logic error
What is a syntax error?
An error that breaks the grammatical rules of the programming language, stopping it being translated and running.
EX: Print("Hello")
What is a logic error?
An error that produces an unexpected output, but doesn’t stop the program from running.
EX: outputting wrong variable
age = 12
name = Steve
print(f"Hello {age}")What are the 4 main types of test data?
Normal
Boundary
Invalid
Erroneous
What is normal test data?
Data which should be accepted by a program without causing any errors.
EX: 13 is an example of normal test data for a program that accepts ages between 10-18 inclusive.
What is boundary test data?
Data that is on the extreme of an input range (and of the correct data type) that should be accepted by a program without causing any errors.
EX: 18 is an example of boundary test data for a program that accepts ages between 10-18 inclusive.
What is invalid test data?
Data that is of the correct data type but does not meet the validation criteria (e.g. is outside of a certain range) and should not be accepted by the computer system.
EX: 20 is an example of invalid test data for a program that accepts ages between 10-18 inclusive.
What is erroneous test data?
Data that is of the incorrect data type and should not be accepted by the computer system.
EX: “Ten” is an example of erroneous test data for a program that accepts ages between 10-18 inclusive.