Defensive design considerations part 1 Flashcards

1
Q

What is input validation in programming?

A

Input validation checks if data input by the user meets specific criteria or rules before processing.

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

What are the 5 types of input validation?

A
  1. Type check 2. Range check 3. Presence check 4. Format check 5. Length check
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a type check in input validation?

A

Ensures the input is of the correct data type

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

What is a range check in input validation?

A

A range check ensures the data is in the correct range

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

What is a presence check in input validation?

A

A presence check ensures that mandatory or required data has been entered

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

What is a format check in input validation?

A

A format check ensures the data input is in the correct format

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

What is a length check in input validation?

A

A length check ensures the input has the correct (or minimum/maximum) number of characters

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

How does input validation make a program more robust?

A

It prevents errors by ensuring data meets specific criteria before processing

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

Why is anticipating misuse important in defensive design?

A

It helps prevent crashes or errors caused by unexpected user actions or inputs.

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

What is a common example of anticipating misuse in programming?

A

Checking for division by zero to avoid program crashes.

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