Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. When an exception is generated, it is said to have been a. built b. thrown c. caught d. killed 2. This is a

image text in transcribed imageimageimage

1. When an exception is generated, it is said to have been a. built b. thrown c. caught d. killed 2. This is a section of code that gracefully responds to exceptions. a. exception generator b. exception manipulator c. exception handler d. exception monitor 752 Chapter 11 Exceptions and Advanced File I/O 3. If your code does not handle an exception when it is thrown, it is dealt with by this. a. default exception handler b. the operating system c. system debugger d. default exception generator 4. All exception classes inherit from this class. a. Error b. RuntimeException c. JavaException d. Throwable 5. FileNotFoundException inherits from 6. a. Error b. IOException c. JavaException d. FileException You can think of this code as being protected" because the application will not halt if it throws an exception. a. try block b. catch block c. finally block d. protected block 7. This method can be used to retrieve the error message from an exception object. 8. 9. a. errorMessage b. errorString c. getError d. getMessage The numeric wrapper classes' "parse" methods all throw an exception of this type. a. ParseException b. NumberFormatException c. IOException d. BadNumberException This is one or more statements that are always executed after the try block has exe- cuted and after any catch blocks have executed if an exception was thrown. a. try block b. catch block c. finally block d. protected block 10. This is an internal list of all the methods that are currently executing. a. invocation list b. call stack c. call list d. list trace Review Questions and Exercises 753 11. This method may be called from any exception object, and it shows the chain of meth- ods that were called when the exception was thrown. a. printInvocationList b. printCallStack c. printStackTrace d. printCallList 12. These are exceptions that inherit from the Error class or the RuntimeException class. a. unrecoverable exceptions b. unchecked exceptions c. recoverable exceptions d. checked exceptions 13. All exceptions that do not inherit from the Error class or the RuntimeException class are a. unrecoverable exceptions b. unchecked exceptions c. recoverable exceptions d. checked exceptions 14. This informs the compiler of the exceptions that could get thrown from a method. a. throws clause b. parameter list c. catch clause d. method return type 15. You use this statement to throw an exception manually. a. try b. generate c. throw d. System.exit(0) 16. This is the process of converting an object to a series of bytes that represent the object's data. a. serialization b. deserialization c. dynamic conversion d. casting 17. True or False: You are not required to catch exceptions that inherit from the RuntimeException class. 18. True or False: When an exception is thrown by code inside a try block, all of the state- ments in the try block are always executed. 19. True or False: IOException serves as a superclass for exceptions that are related to programming errors, such as an out-of-bounds array subscript. 20. True or False: You cannot have more than one catch clause per try statement. 754 Chapter 11 Exceptions and Advanced File I/O 21. True or False: When an exception is thrown, the JVM searches the try statement's catch clauses from top to bottom and passes control of the program to the first catch clause with a parameter that is compatible with the exception. 22. True or False: Not including polymorphic references, a try statement may have only one catch clause for each specific type of exception. 23. True or False: When in the same try statement you are handling multiple excep- tions and some of the exceptions are related to each other through inheritance, you should handle the more general exception classes before the more specialized excep- tion classes. 24. True or False: The throws clause causes an exception to be thrown. Find the Error Find the error in each of the following code segments: 1. catch (FileNotFoundException e) { System.out.println("File not found."); } try { File file new File("MyFile.txt"); Scanner inputFile = new Scanner(file); } 2. // Assume inputFile references a Scanner object. try { input = inputFile.nextInt(); } finally { } inputFile.close(); catch (InputMismatchException e) { System.out.println(e.getMessage()); } 3. try { } number Integer.parseInt(str); catch (Exception e) { } System.out.println(e.getMessage());

Step by Step Solution

3.33 Rating (129 Votes )

There are 3 Steps involved in it

Step: 1

The detailed answer for the above question is provided below Lets go through each question and provide the correct answer 1 When an exception is generated it is said to have been b thrown 2 This is a ... blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Starting Out With Java From Control Structures Through Data Structures

Authors: Tony Gaddis

6th Edition

0133957055, 978-0133957051

Students also viewed these Programming questions