1. When an exception is generated, it is said to have been a. built b. thrown...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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()); 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());
Expert Answer:
Answer rating: 100% (QA)
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 ... View the full answer
Related Book For
Starting Out With Java From Control Structures Through Data Structures
ISBN: 9780133957051
6th Edition
Authors: Tony Gaddis
Posted Date:
Students also viewed these programming questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
This is a section of code that gracefully responds to exceptions. a. Exception generator b. Exception manipulator c. Exception handler d. Exception monitor
-
Every human being fears to fail. This is the same case with the leaders. Most of the leaders are afraid of some things, but failing is the most feared among all of them. The loss of direction among...
-
What is another name for the standard deviation of the variable x? What is the reason for that name?
-
P is the point (k, 3k) and Q is the point (5k, 5k). Find the equation of the perpendicular bisector of PQ.
-
What is a compilation unit?
-
The intangible assets section of Sappelt Company at December 31, 2015, is presented below. Patents ($70,000 cost less $7,000 amortization) ......... $63,000 Franchises ($48,000 cost less $19,200...
-
When a company lends money to employees at a rate of 4%, the company will record ______. Multiple choice question. a liability called Accounts Payable a liability called Notes Payable an asset called...
-
Martha died this year with a net allowable capital loss for the year of death of $100,000. She had income from all sources of $5,000 in the year of death, $30,000 last year, and $27,000 two years...
-
Two all-equity firms are negotiating a merger. The acquirer has 20,000 shares outstanding with a market price of $70 per share, while the target has 14,000 shares outstanding with a market price of...
-
What term is used to describe a protein that has unfolded because of changes in temperature or pH?
-
If you were starting a small business, would you prefer that your partner is a utilitarian, an altruist, or an egoist? Why?
-
Use a table of cash flows to analyze the cash flows and the P/L at expiration of the following strategy: Sell short ABC's stock and sell two OCT, 155 puts and purchase two OCT,175 calls.
-
What is the rationale of the deemed sale treatment? What does it set out to accomplish?
-
You are working as a compensation analyst. You are given the following information: The market pay regression line (after aging) is: y=900+.5x. Your company's pay policy is to lead the market by...
-
The experment was run ot a constant pressue d 1013kPa. 2lgd in the experiment . The enthalpy of fusion of naphthelene is isleJ mol-, the heat copacity of solid naphthalane is 161.4 Jmolk and the heat...
-
What is your assessment of the negotiations process, given what you have studied? What are your recommendations for Mr. Reed? You must justify your conclusions
-
Find the Error throughout each step. 1. Int[] collection = new int[-20]; 2. Int[] hours = 8, 12, 16; 3. Int[] table = new int[10]; for (int x = 1; x
-
Write code that does the following: opens a file named MyName.txt, reads the first line from the file and displays it, and then closes the file.
-
True or False: When a class contains an abstract method, the class cannot be instantiated.
-
What is the value of equity at time zero? A. 44,055. B. 77,973. C. 122,027. Mun Hoe Yip is valuing Pure Corporation. Pure is a simple corporation that is going out of business in five years,...
-
Economic income during Year 1 is closest to: A. 23,186. B. 29,287. C. 46,101. Mun Hoe Yip is valuing Pure Corporation. Pure is a simple corporation that is going out of business in five years,...
-
What is residual income during Year 1? A. 2,916. B. 2,542. C. 8,653. Mun Hoe Yip is valuing Pure Corporation. Pure is a simple corporation that is going out of business in five years, distributing...
Study smarter with the SolutionInn App