0Still learning
Know0
What is defensive design?
Enjoying Flashcards?
Tell us what you think
What is defensive design?
Defensive design is an approach to software development where every possible input from a user is considered to anticipate all of the ways a user could misuse a program.
Define robust (programming)
Robust is ensuring that the final program is reliable for all users.
True or False?
All errors in software can be foreseen by the developer when writing the software.
False.
Some errors can occur in software that cannot be foreseen by the developer when writing the software.
Define peripheral errors
Peripheral errors are caused when peripherals don't perform as intended.
For example, printers running out of paper, ink or having a paper jam.
Define disk errors
Disk errors are errors that can occur on disk drives like running out of disk space, files/folders not being found, or corrupted files.
Define communication errors
Communication errors are errors that can occur when a program's connection to a host server is lost.
What is authentication?
Authentication is the process of ensuring that a system is secure by asking the user to complete tasks to prove they are an authorised user of the system.
State the meaning of CAPTCHA
A CAPTCHA is a method of authentication where a user must complete a task to prove they are not a bot submitting data.
True or False?
Allowing users to recover passwords via email/SMS codes is a method of authentication.
True.
Allowing users to recover passwords via email/SMS is a method programmers can use to authenticate users.
True or False?
Authentication is not needed because bots cannot submit data in online forms.
False.
Authentication is done because bots can submit data in online forms.
What is input validation?
Input validation is code which is used to check that an input from a user is acceptable and that it matches the requirements of the program.
Length check
A length check is a type of input validation that checks the length of a string input. E.g. ensuring a password is more than 8 characters
Type check
A type check is a type of input validation that checks the data type of a field input. E.g. ensuring a user's age has been entered as an integer
Range check
A range check is a type of input validation that ensures a numeric input falls within a particular range. E.g. a user's age falls between the digits 0-110
Presence check
A presence check is a type of input validation that checks if any data has been entered in a field. E.g. a user's name field has not been left blank
Format check
A format check is a type of input validation that ensures the data has been entered in the correct format. E.g. a date has been entered as DD/MM/YYYY
True or False?
There can be occasions where only one type of input validation is used on a field.
False.
There can be occasions where more than one type of validation will be used on a field.
What are the 5 main categories of input validation?
The 5 main categories of input validation are:
length check
type check
range check
presence check
format check.
password = "letmein"
State the Python code to check the length of the string password
password_length = len(password)
State the meaning of isdigit()
The isdigit() method checks if a string contains only digits. It returns True if all characters are digits, False otherwise.
What is program maintainability?
Program maintainability is used to ensure programmers can easily understand what a program is doing months or years after having first written it.
Commenting of code (maintainability)
Commenting of code is used for program maintainability to explain the purpose of the code in a particular section.
White space (maintainability)
White space is used for program maintainability to make each section clear and easy to see.
Indentation (maintainability)
Indentation is used for program maintainability to show each instance of selection and iteration and make it clear which code belongs to which clause.
Sensible variable names (maintainability)
Sensible variable names are used for program maintainability so the name explains what the variable or data structure does to prevent confusion.
Use of sub-programs (maintainability)
Using sub-programs like functions or procedures is for program maintainability to split code into reusable sections and increase overall structure.
True or False?
Program maintainability is not important when programming alone.
False.
Program maintainability is important to ensure the programmer can understand the code months or years later.
What are the benefits of using maintainability features like comments and whitespace?
Using maintainability features makes the code easier to:
read
understand
debug
improve.
Define debugging
Debugging is the process of finding and resolving errors or defects within a program.
What features promote maintainability?
The features that promote maintainability are:
comments
meaningful variable names
white space
indentation.
What are the four main purposes of testing?
The purpose of testing programs is:
To ensure there are no errors or bugs
To ensure the code performs as intended
To ensure no unauthorised access
To check it meets all requirements.
Iterative testing
Iterative testing is a type of testing where each part of the program is tested during the development of the program.
Final testing
Final testing is a type of testing done at the end of development.
True or False?
Iterative testing involves running the code each time while developing to test it.
True.
Iterative testing means repeatedly testing the program while continuing to make changes and improvements during development.
What are the two main types of testing?
The two main types of testing are iterative testing and final testing.
Normal data
Normal data is data that falls within the expected range for testing a program against real data during final testing.
Boundary data
Boundary data is data at the minimum or maximum values of the expected range for testing during final testing.
Erroneous data
Erroneous data is invalid or incorrect data used for testing to check how the program handles errors during final testing.
True or False?
Alpha and beta testing are types of iterative testing.
False.
Alpha and beta testing are types of final testing.
Performing a test on a name field.
What type of test data is "99"?
Erroneous
Define syntax error
A syntax error is an error that breaks the grammatical rules of a programming language and stops it from running.
Define logic error
A logic error is incorrect code that allows the program to run, but produces an incorrect or undesired output.
True or False?
Syntax errors are easily identifiable because the IDE provides information about the error.
True.
Syntax errors are easily identifiable as the IDE will provide information about what the error is to help fix it.
What should you look at when the IDE error message points to a line after the actual error line?
Look at the line of code above the one given in the error message, as that may contain the actual syntax error.
name = input("Enter your name"
Print("Nice to meet you, name)
Identify three syntax errors
name = input("Enter your name")
print("Nice to meet you", name)
Line 1: missing bracket
Line 2: uppercase P on print function
Line 2: missing "
True or False?
Logical and Boolean operators are common causes of logic errors.
True.
Areas to check for logic errors are logical operators (<, >, ==, !=), Boolean operators (AND, OR, NOT) and division by 0.
age = input(int(input("Enter your age: "))
if age > 11 or age < 18:
print("You are now in secondary school!")
else:
print("You are not in secondary school!")
A user enters 21 as their age. Identify the logic error.
age = input(int(input("Enter your age: "))
if age > 11 or age < 18:
print("You are now in secondary school!")
else:
print("You are not in secondary school!")
Entering 21 outputs "You are now in secondary school!" exposing that the incorrect Boolean operator OR was used instead of AND.
True or False?
A logic error is easier to find than a syntax error.
False.
Logic errors are harder to find than syntax errors as the program still runs, making it more difficult to find them
Define normal test.
A normal test is when the user enters data that should be accepted in the program.
Define boundary test.
A boundary test is when the user enters data that is on the edge of what is acceptable.
Define erroneous test.
An erroneous test is when the user enters data of the wrong data type.
Define invalid test.
An invalid test is when the user enters data of the right data type but outside of what is accepted.
What are the 4 main categories of tests?
The 4 main categories of tests are:
normal tests
boundary tests
erroneous tests
invalid tests.
name = input("What is your name? ")
age = int(input("How old are you? "))
if age >=12 and age <=18:
print("Welcome, " + name + "! Your age is accepted.")
else:
print("Sorry, " + name + "! Your age is not accepted.")
Give an example of a normal test.
Example normal test:
13-17 (Expected output: Accepted)
name = input("What is your name? ")
age = int(input("How old are you? "))
if age >=12 and age <=18:
print("Welcome, " + name + "! Your age is accepted.")
else:
print("Sorry, " + name + "! Your age is not accepted.")
Give an example of a boundary test.
Example boundary test:
12 or 18 (Expected output: Accepted).
name = input("What is your name? ")
age = int(input("How old are you? "))
if age >=12 and age <=18:
print("Welcome, " + name + "! Your age is accepted.")
else:
print("Sorry, " + name + "! Your age is not accepted.")
Give an example of a erroneous test.
Example erroneous test:
Any non-integer value, e.g. "F" (Expected output: Rejected).
name = input("What is your name? ")
age = int(input("How old are you? "))
if age >=12 and age <=18:
print("Welcome, " + name + "! Your age is accepted.")
else:
print("Sorry, " + name + "! Your age is not accepted.")
Give an example of a invalid test.
Example invalid test:
Any integer value outside of 12-18 (Expected output: Rejected).
True or False?
Invalid tests are important to check the robustness of a program.
True.
Invalid tests are carried out to test the robustness of the program.