Exceptions & Errors Flashcards Preview

OCA Summary > Exceptions & Errors > Flashcards

Flashcards in Exceptions & Errors Deck (8)
Loading 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.

2
Q

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

A

Throwable

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

4
Q

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

A

An exception object.

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.

6
Q

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

A

The runtime system attempts to find something to handle it by

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.

8
Q

True or False

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

A

False