2.3 Producing Robust Programs COMPLETE Flashcards

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

What is a check digit?

A

The last one or two digits in a code are used to check the other digits are correct

E.g. bar code readers in supermarkets use check digits.

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

What is a format check?

A

Checks that the data is the correct format.

E.g. National Insurance Number in the form LL 99 99 99 L where L is any letter and 9 is any number.

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

What is a length check?

A

Checks that the data isn’t too short or too long.

E.g. a password needs to be more than 8 characters.

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

What is a lookup table?

A

Looks up acceptable values in a table.

E.g. there are only 7 possible days of the week.

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

What is a presence check?

A

Checks that data has been entered into a field.

E.g. in most databases, a key field card can’t be left blank.

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

What is a range check?

A

Checks that a value falls within a specific range.

E.g. number of hours worked (h):
0 < h < 50

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

What is a spell check?

A

Looks up words in a dictionary.

E.g. Microsoft Word underlines incorrectly spelled words in red.

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

Define authentication

A

A coding method to check that a user is who they say they are and allowed to accesses the program.

The program checks a huge table and reports back to see if the information matches up, if it does then the access is granted

E.g.biometrics, key cards or email.

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

Define input sanitisation

A

Ensures that the input is correct and contains only the permitted characters letters and symbols.

E.g. Dave not Dav%e so the % would be removed.

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

Define maintainability

A

If a program is to be defensive against attacks, then it has to be maintained and up to date.

Informs the reader of a bug or issues.
Explains the code and its function in more detail.
Stop a line of section of code from executing.

E.g. comments and indentation/spacing.

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

Define misuse

A

Maybe in the form of a brute force attack on the program.

Unauthorised acts with intent to impair the operation of the computer.

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

Define iterative testing

A

Testing the code as you create it.

E.g. line by line or a section at a time.

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

Define final testing

A

Carried out at the end of the program when it has been written.

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

Define syntax errors

A

Mistakes in the formatting (the way in which the code is written).

E.g. SPAG mistakes or unneeded capital letters.

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

Define logic errors

A

A bug in a program that causes it to operate incorrectly, but not to terminate or crash (not as intended).

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

Define validation

A

A check made by a computer to ensure that the data entered is sensible or reasonable and within certain limits and rules.

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

What should you consider in defensive design?

A

When data is entered into a program, it’s important that it’s valid, in order for the program to work correctly.

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

When are runtime errors detected?

A

Errors which may cause program errors or the computer to crash, even if there appears to be nothing wrong with the program.

E.g. running out of memory.

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

Computer programs should/shouldn’t be designed to ensure that they can cope with unexpected or erroneous input from users

A

should

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

True/False: Defensive design ensures that there are no errors or bugs

A

False, the number of errors or bugs is minimised

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

True/False: Defensive design ensures that the program behaves as expected in spite of unexpected user actions

A

True

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

True/False: Defensive design ensures that all possible errors that could occur are identified and allowed for

A

True

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

Computer scientists should/shouldn’t plan for all contingencies that might occur

A

Should. These include accidental or deliberate erroneous inputs or item selections

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

______________ is the process of determining the identity of a user

A

Authentication

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

What is authentication usually based on?

A

A username and an associated password

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

What does authentication do with a username and password?

A

Checks that the username and password exist

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

Why does entering a correct username and password combination not prove that the person inputting them is the person whom they were issued?

A

It may be identity theft

28
Q

What is the data validation process?

A

A process that checks that data that is input is sensible, reasonable and appropriate to be processed by the program.

29
Q

Why should data validation checks be used?

A

To ensure that required data is actually input and is within a certain range or of a required length

30
Q

Give 3 common data validation checks

A

Any 3 from presence check, length check, range check, type check and format check

31
Q

What does a presence check ensure?

A

That data has been entered

32
Q

What does a range check ensure?

A

That an input falls within a required range

33
Q

What does a length check ensure?

A

That a specified number of characters have been entered

34
Q

What does a format check ensure?

A

That data is entered in the correct format, such as entering a date in the format DD/MM/YY

35
Q

What does a type check ensure?

A

That the data type of the input is of the specified data type, for example that an integer is entered when specifying a quantity

36
Q

What does testing of software ensure?

A

That the software produces the expected results and meets the needs of the users

37
Q

All software should be tested to ensure that it is ______ so it produces the expected results and can withstand malicious users.

A

Robust

38
Q

Testing should be ___________ and should try to find errors rather than just proving that a program works

A

destructive

39
Q

When are iterative tests carried out?

A

As the software is being developed

40
Q

What is iterative testing?

A

When tests are carried out on each module and the results are used to inform further development

41
Q

When is terminal testing carried out?

A

Once the software has been developed

42
Q

What is another name for terminal testing?

A

Final testing

43
Q

What is the first stage of terminal testing?

A

Alpha testing

44
Q

What is the second stage of terminal testing?

A

Beta testing

45
Q

Who is alpha testing done by?

A

Developers

46
Q

Who is beta testing done by?

A

Potential users of software

47
Q

Why should suitable test data be used?

A

To test the software in all situations

48
Q

Normal data tests the software under…

A

Normal working conditions

49
Q

Boundary data tests the software under…

A

Extreme conditions (e.g. it will test that length and range checks are functioning correctly)

50
Q

Erroneous data tests how the software deals with…

A

Incorrect inputs that may be entered deliberately or by mistake

51
Q

What should programs have in place to deal with erroneous data inputs?

A

Routines to deal with them and inform the user that the data is, for example, outside an expected range or numbers are entered instead of text

52
Q

What are syntax errors?

A

Grammatical mistakes in code, which could be caused by a misspelling (prnit instead of print) or by missing colons, semi-colons or brackets

53
Q

Is a missing semi-colon a syntax error?

A

Yes

54
Q

Is spelling the word print: “prnit” in code a syntax error?

A

Yes

55
Q

What do syntax errors do to a program?

A

Prevent a program from running

56
Q

Syntax errors are difficult/easy to spot

A

Difficult

57
Q

How can syntax errors be prevented?

A

By using an IDE

58
Q

What does IDE stand for?

A

Integrated Development Environment

59
Q

What do logic errors cause?

A

Unintended output because of a fault in the logic of the algorithm (e.g. using the AND operator instead of the OR operator, or a loop that may run forever)

60
Q

Is a loop that may run forever a syntax error?

A

No, it is a logic error

61
Q

Is using an AND operator instead of an OR operator a syntax error or a logic error?

A

Logic

62
Q

What are used to help identify logic errors?

A

Trace tables

63
Q

Program code should be easy to follow and understand in case…

A

Changes have to be made or errors corrected

64
Q

Why should explanations be added to code?

A

To explain the code and make it easier to understand

65
Q

How are comments added to code?

A

Two forward slashes (//) or a hashtag (#)

66
Q

All code that depends on a previous statement should be ________

A

Indented

67
Q

Why should meaningful identifiers be used in code?

A

So it is easier to follow and understand the program