Defensive Programming and Testing (yr 11) Flashcards

1
Q

What is defensive programming?

A

Defensive programming is a practice of writing code that anticipates and handles misuse, errors, and unexpected inputs to make programs more reliable and secure.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Name three defensive design techniques.

A
  1. Input Validation: Ensures inputs are in the expected format.
  2. Authentication: Verifies user identity (e.g. login systems).
  3. Maintainable Code: Using comments, indentation, and meaningful variable names to improve readability.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is iterative testing?

A

Testing carried out during development to ensure each part of the program works as it is built.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is final/terminal testing?

A

Testing performed once development is complete to check the whole system meets requirements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a trace table?

A

A table used to manually track the values of variables and outputs at each step in an algorithm to detect logic errors.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the difference between normal, boundary, and erroneous data?

A

• Normal data: Inputs that are expected and valid.
• Boundary data: Values at the edge of acceptable ranges.
• Erroneous data: Invalid inputs used to test error handling.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly