Exceptions & Errors Flashcards

1
Q

What Is an Exception?

A

An exception is an event that occurs during the execution of a program that disrupts the normal flow of instructions.

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

Exception and Error classes are both subclasses of the _______ class.

A

Throwable

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

What is called when the system creates an exception object and hands it to the runtime system?

A

Is called throwing an exception

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

When an error occurs in a method, what does the method create?

A

An exception object.

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

What does the “exception object” contains?

A

It contains information about the error and the state of the program when the error occurred.

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

What does the runtime system do with the “exception object”?

A

The runtime system attempts to find something to handle it by

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

In which case, a program is expected to recover?

A - If an error occurs.

B - If an exception occurs.

C - Both of the above.

D - None of the above.

A

Answer : B
Explaination
A program is expected to recover if an exception occurs.

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

True or False

Is it necessary that each try block must be followed by a finally block?

A

False

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