Defensive design considerations 2 Flashcards

1
Q

How can a programmer prevent division by zero errors?

A

Check that a variable is not zero before attempting a division by it e.g
IF num != 0 then
average = total /num
ELSEIF
print(“Error”)

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

What is a communication error in online systems?

A

The connection between online systems and host servers is dropped, potentially causing a program to crash or hang when loading / saving data

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

How should a programmer handle communication errors?

A

Enable ways for the user to cancel requests or for them to fail gracefully, reporting the connection error

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

What are common printer errors a programmer should anticipate?

A
  • Printer may run out of paper
  • Printer may run out of ink
  • Printer may have a jam
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How should a programmer handle printer errors?

A

The programmer should not assume that an output to a printer was successful and should always have options to reprint reports or receipts

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

What are common disk errors a programmer should handle?

A
  • The file / folder not being found
  • The disk being out of space
  • The data in the file being corrupt
  • The end of the file being reached
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How can a programmer make a program robust against disk errors?

A

Having the program checking files and data before attempting to use them for further processing

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

What is authentication in programming?

A

Ensuring data used by systems is secure

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

What are common methods to secure data in systems?

A
  • Username and password to access systems
  • Recovering a password requiring clicking on a link within the email that is sent to the registered address
  • Encryption of data files.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How can programmers protect against online bots submitting data automatically?

A

Using software such as reCAPTCHA that verifies the user is human

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

What is SQL injection?

A

SQL injection is a hacking method where malicious SQL code is inserted into input fields. Programmers can prevent it by sanitizing inputs.

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