ITSC 1213 FINAL EXAM QUESTIONS AND CORRECT
ANSWERS
What is the call stack? - Answers - Ordered list of methods that were called to get to the
method where the error occurred.
What class identifies the kind of error that occurred? - Answers - The exception class
Can you implement your own exception classes by extending the Exception class? -
Answers - Yes
An exception object gets created when an exceptional event occurred that disrupted the
normal flow of the application. What is this called and why. - Answers - This is called to
throw an exception because in java you use the keyword "throw" to hand the exception
to the runtime.
What specifically happens when a method throws an exception object? - Answers - The
runtime searches the call stack for a piece of code that handles it.
True or False: Java supports checked and unchecked exceptions? - Answers - True
When should you use checked exceptions? - Answers - For all exceptions that you can
anticipate and that a well written application should be able to handle.
What class does a checked exception extend? - Answers - The exception class
A method that throws a checked exception or that calls a method that specifies a
checked exception needs to do what? - Answers - Either specify or handle it
Unchecked exceptions extend what? - Answers - RuntimeException
When should you use unchecked exceptions? - Answers - For internal errors that you
can't anticipate and that the application cant recover from.
True or False: methods can but don't need to handle or specify an unchecked
exception? - Answers - True
Common examples of unchecked exceptions: - Answers - NullPointerException
IllegalArgumentException
Try-Catch-Finally block handles java exceptions. What does each block do? - Answers -
Try block encloses the code section which might throw an exception
ANSWERS
What is the call stack? - Answers - Ordered list of methods that were called to get to the
method where the error occurred.
What class identifies the kind of error that occurred? - Answers - The exception class
Can you implement your own exception classes by extending the Exception class? -
Answers - Yes
An exception object gets created when an exceptional event occurred that disrupted the
normal flow of the application. What is this called and why. - Answers - This is called to
throw an exception because in java you use the keyword "throw" to hand the exception
to the runtime.
What specifically happens when a method throws an exception object? - Answers - The
runtime searches the call stack for a piece of code that handles it.
True or False: Java supports checked and unchecked exceptions? - Answers - True
When should you use checked exceptions? - Answers - For all exceptions that you can
anticipate and that a well written application should be able to handle.
What class does a checked exception extend? - Answers - The exception class
A method that throws a checked exception or that calls a method that specifies a
checked exception needs to do what? - Answers - Either specify or handle it
Unchecked exceptions extend what? - Answers - RuntimeException
When should you use unchecked exceptions? - Answers - For internal errors that you
can't anticipate and that the application cant recover from.
True or False: methods can but don't need to handle or specify an unchecked
exception? - Answers - True
Common examples of unchecked exceptions: - Answers - NullPointerException
IllegalArgumentException
Try-Catch-Finally block handles java exceptions. What does each block do? - Answers -
Try block encloses the code section which might throw an exception