Simple error handling techniques Flashcards

(11 cards)

1
Q

What is data validation?

A

Necessary to ensure data is complete, falls within a set of boundaries or specified within the code and is sensible. It aims to reduce the amount of erroneous data captured by the program or the system.

Can be performed using length, presence, range, type and format checks

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

What does a presence check do?

A

Ensures the field is not left blank/null

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

What does a range check do?

A

Ensures that data entered is within the correct range. This is done through the use of upper and lower boundaries

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

What does a length check do?

A

Ensures the data entered does not exceed or is not shorter than a particular number of characters

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

What does type check do?

A

Ensures the data is of the correct data type?

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

What does a format check do?

A

Ensures data is entered in the correct format, this means the data must conform to a pattern

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

When can you detect a syntax error?

A

When the program is being compiled, a program with syntax errors will not compile

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

When can execution and run time errors be detected?

A

During program execution and will cause the program to crash

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

When can a logic error be detected?

A

During testing, the output wont match the expected output

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

What is debugging?

A

The process of detecting and correcting or removing errors from the code, you may have to go through code lines one at a time

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

What happens during exception/error handling?

A

The program will attempt to deal with an error generated at run time so that the program does not crash. When an error occurs, an exception is raised that “calls” code to handle the error. An un-handled exception will still cause the program to crash.

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