SLR 2.3 Producing robust programs Flashcards

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

Describe three ways in which a programmer can make their code maintainable

A
  • Use of comments to explain sections of code.
  • Using indentation to identify program branches and code iterations.
  • Using descriptive variable names to make the program easier to understand.
  • Use of procedures to make the code easier to read.
  • Using whitespace or comment markers to indicate the beginning/end of sections of code.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain what is meant by the term iterative testing

A
  • Performed whilst the software is being written.
  • Each new module/section of code/procedure/iteration/program branch is checked for functionality/logic errors.
  • Checking that the new piece of code has not broken existing code, introducing new errors.
  • Checking the program handles erroneous and exceptional situations.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a logic error?

A

An error which is not a syntax error but an error in the program logic (it will run but may error or may simply not do what you wanted / expected)

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

What is a syntax error?

A

An error in the syntax, that is to say the structure of the language (e.g. a missing colon ‘:’ or lack of correct indentation, incorrect spelling of key words etc.). Syntax errors will cause interpretted languages such as Python to error and compiled languages such as ‘C’ to fail to compile.

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

State what is meant by the term, “input sanitisation”

A

• Removing any white space and turning the input into a format that the program is expecting.

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

Explain what is meant by the term, “presence check”

A

Checking that any input is received (not just “” when you hit enter without making another entry)

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

Explain what is meant by the term, “length check”

A

Checking the input from the user has the correct number of characters (e.g. password is not 1 character)

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

Explain what is meant by the term, “range check”

A

Checking the user input has a value within the expected range (e.g. age is not 3000!)

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

Explain what is meant by the term, “range check”

A

Checking the user input is of the correct type (strictly speaking the type is always a string for keyboard input but here we mean can it be converted into the correct type e.g. int(“ten”) would fail but int(“10”) will work)

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

Explain what is meant by the term, “format check”

A

Checking the user input is of the correct format e.g. a date may be required to be in ‘dd/mm/yyyy’ format.

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

What is a division by zero error?

A

If a computer attempts to process any value divided by zero it will crash (the answer is infinity which cannot be represented in binary)

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

What is reCaptcha and where is it used?

A

reCaptcha is a method of user authentication where a website tries to ensure the user is human and not a ‘bot. Initially reCaptcha methods used blurred images of text for the user to decipher but as ‘bots have become more sophisticated they have moved onto clicking parts of an image with particular visual clues.

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

What is terminal testing?

A

Testing when an entire program is complete to check it functions according to the specification given and meets all success criteria

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
In the context of test data what do each of the following terms mean:
valid
invalid
valid extreme / valid edge
invalid extreme / invalid edge
A
  • valid data is within the acceptable values
  • invalid data is outside the acceptable values
  • valid extreme / valid edge is only just acceptable
  • invalid extreme / invalid edge is only just unacceptable
For example if we need a value of age to be between 8 and 80 we might use:
-8 invalid
7 invalid extreme / invalid edge 
8 valid extreme
40 valid
80 valid extreme
81 invalid extreme
350
How well did you know this?
1
Not at all
2
3
4
5
Perfectly