Java Chapter 12 Questions with Detailed
Verified Answers (100% Correct Answers)
/Already Graded A+
In object-oriented programming terminology, an unexpected or error condition is a(n)
___________.
Ans: exception
All Java Exceptions are ___________.
Ans: Throwables
Which of the following statements is true?
a. Exceptions are more serious than Errors.
b. Errors are more serious than Exceptions.
c. Errors and Exceptions are equally serious.
d. Exceptions and Errors are the same thing.
Ans: Errors are more serious than Exceptions
The Error class is more "serious" because a program usually cannot recover from Errors.
The method that ends the current application and returns control to the operating system is
___________.
Ans: System.exit()
In object-oriented terminology, you __________ a procedure that might not complete
correctly.
Ans: try
A method that detects an error condition or Exception __________ an Exception
Ans: throws
A try block includes all of the following elements except ___________.
, Page |2
a. the keyword try
b. the keyword catch
c. curly braces
d. statements that might cause Exceptions
Ans: the keyword catch
The segment of code that handles or takes appropriate action following an exception is a
__________ block.
Ans: catch
You __________ within a try block
Ans: can place any number of statements
If you include three statements in a try block, and follow the block with three catch blocks,
and the second statement in the try block throws an Exception, then ___________.
Ans: the first matching catch block executes
The position of the statement that throws the Exception is irrelevant. It is the Exception type in
the catch block that matters.
When a try block does not generate an Exception and you have included multiple catch
blocks, ___________.
Ans: no catch blocks execute
The catch block that begins catch(Exception e) can catch Exceptions of type ___________.
Ans: either:
IOException
or
ArithmeticException
The code within a finally block executes when the try block ___________.
Ans: either:
identifies one or more Exceptions
or
does not identify any Exceptions
An advantage to using a try...catch block is that exceptional events are ___________.
Ans: isolated from regular events