2.3 - Programming Robust Programs Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Name some defensive design considerations

A
  • Anticipating misuse
  • Input sanitisation
  • Validation
  • Verification
  • Authentication
  • Maintainable code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can anticipating misuse help in defensive design considerations?

A

Planning ahead to take steps against potential misuse

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

How can inputting sanitisation help in defensive design considerations?

A

Cleaning up data that has been input

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

What is Validation?

A

A process to check that data is reasonable or sensible before it is accepted

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

What is Verification?

A

Checking whether data has been entered correctly

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

What is maintainable code?

A

Allowing other programmers to understand the code

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

Give some examples on maintainable code

A
  • Comments
  • Indentation
  • Meaningful variable names
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How can authentication help in defensive design considerations?

A

Ensuring only authorised users can gain access to a system

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

What are the types of input validation?

A
  • Range
  • Type
  • Format
  • Presence
  • Lookup Table
  • Length
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a Range check?

A

Checks data is within a certain range

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

What is a Type check?

A

Checks data is a certain data type

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

What is a Format check?

A

Checks data is entered in a certain way

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

What is a Presence check?

A

Checks that data has actually been entered and not left blank

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

What is a Lookup Table?

A

A table of acceptable entries

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

What is a Lookup table also known as?

A

A List

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

What is a Length check?

A

Checks the length of the input is within a certain amount

17
Q

How does using constants help to improve maintainability?

A

Keeps the program code consistent
—> Makes it easier to read and debug a program

18
Q

What is modularisation?

A

Using subprograms to reuse code and make them easier to test

19
Q

How does using appropriate variable names help to improve maintainability?

A

Ensures the purpose of a variable is immediately understood

20
Q

What is the main purpose of testing?

A

To ensure a program works correctly no matter what input has been entered by the user

21
Q

Give some other reasons on why programs should be tested

A
  • User requirements have been met
  • Errors have been removed
  • Program doesn’t crash while running
22
Q

What are the types of testing?

A
  • Iterative testing
  • Final testing
23
Q

When does iterative testing take place?

A

During program development

24
Q

Describe how iterative testing works

A

Programmer develops a module, tests it and repeats this process until the module works as expected

25
Q

When does final testing take place?

A

After development & before the program is released to the end user

26
Q

What is final testing also known as?

A

Terminal testing

27
Q

What are the types of programming errors?

A
  • Syntax
  • Logical
28
Q

What is a syntax error?

A

A mistake in the grammar or spelling of the program
—> Prevents program from being compiled

29
Q

What is the difference between a logical error and a syntax error?

A

Logical
Still works but displays wrong output

Syntax
Program won’t be compiled and won’t work at all

30
Q

What is a logical error?

A

A mistake made by the programmer
(still works but displays the wrong output)

31
Q

What is the purpose of test data?

A

Used to test whether a program is functioning correctly

32
Q

What should test data cover?

A

Range of possible & incorrect inputs

33
Q

What are the types of test data?

A
  • Normal data
  • Boundary data
  • Invalid data
34
Q

What is invalid data also known as?

A

Erroneous data

35
Q

What is normal data?

A

Sensible data that the program should accept & be able to process

36
Q

What is boundary data?

A

Data at the extreme boundary of any data changes

37
Q

What is invalid data?

A

Data that the program cannot process & should not accept