Unit 8 Logic and Languages (2.3 Producing Robust Programs) Flashcards

(15 cards)

1
Q

What is defensive design?

A

Creating programs that can handle unexpected or erroneous data and/or inputs by anticipating misuse.

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

How is defensive design put into place by programers?

A

they will try to:
* use input validation & authentication
* anticipate how users might misuse their program, then attempt to prevent this
* ensure their code is well maintained
* reduce the number of errors in the code throught testing

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

What is anticipating misuse?

A

designing a system, predicting how users can act in an unintended or malicious way and minimising this

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

What is authentication?

A

the process of determining the identity of a user

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

What is input validation?

A

the process of checking that the data entered by a user is appropriate for its use, so that it can be correctly processed without any errors

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

What are the (3) types of input validation?

A
  • presence check
  • range check
  • length check
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a presence check?

A

checks that data has been entered and not blank.

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

What is a range check?

A

checks that an input falls within the required range.

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

What is a length check?

A

checks a specified number of characters have been entered.

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

Give a python example of presence check

A

name = input(“Enter your name”)
if name == “”:
print(“Invalid”)

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

Give a python example of range check

A

num = int(input(“Enter a number less than 10”))
if num >= 10:
print(“Too large!”)

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

Give a python example of length check

A

password = input(“Enter a password, minimum 8 characters.”)
if len(password) < 8:
print(“Password too short!”)

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

What is maintaining programs?

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

What are the (4) ways of maintaining programs?

A
  • sub programs
  • naming conventions
  • indentation
  • commenting
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly