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
-
an ! Required information Assume that the couple shown acts in a vertical plane. Take M= 15 kip.in. B r = 0.75 in. M 1.2 in. 1.2 in. 4.8 in.- Determine the stress at point A. The stress at point A is...
-
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...
-
In the presence of AR(1) autocorrelation, what is the method of estimation that will produce BLUE estimators? Outline the steps involved in implementing this method.
-
Using the failure rate data in Table 10.1, evaluate the reliability and mean time between failures for the high-pressure interlock in Fig. 10.4. Assume that the failure rate for the solenoid switch...
-
FRS 5 - Reporting the Substance of Transactions - requires that a reporting entity's financial statements should report the substance of the transactions into which it has entered. FRS 5 states that...
-
For SKU A3510 at the Hardware Warehouse, the order quantity has been set at 150 units each time an order is placed. The daily demand is normally distributed, with a mean of 12 units and a standard...
-
Find an equation of the tangent line to the parabola y = x - 4x + 5 at the point (1, 2). SOLUTION From the previous example, we know the derivative of f(x) = x - 4x + 5 at the number a is f'(a) = 2a...
-
Parent Co, a U.S. firm, paid $525,000 cash to acquire all of the stock of the British Trm sub Co when the book value of Sub's net assets was equal to fair value. This business combination occurred on...
-
Consider a market with demand function P = 12 0.04Q and marginal cost function P = 6 +0.12Q. (a) If this market is perfectly competitive, compute the equilibrium price, the equilibrium quantity, the...
-
Presented below are income statement data for Poole \& Company for 2019: Required Prepare a multi-step income statement for 2019 and calculate the company's return on sales ratio. If Poole's return...
-
Globe Travel Agency pays an employee \(\$ 600\) in wages each Friday for a five-day work week ending on that day. The last Friday of January falls on January 27. What adjusting entry should be made...
-
The publisher of International View, a monthly magazine, received two-year subscriptions totaling \(\$ 12,240\) on January 1. (a) What entry should be made to record the receipt of the \(\$ 12,240\)...
-
On January 1, Prepaid Insurance was debited with the cost of a two-year premium in the amount of \(\$ 3,744\). What adjusting entry should be made on January 31 before the January financial...
-
Rally Corps Eastern Division has sales of \($190,000\), cost of goods sold of \($110,000\), operating expenses of \($35,000\), average invested assets of \($900,000\), and a hurdle rate of 12...
-
Alfredo Company purchased a new 3-D printer for $863,000. Although this printer is expected to last for ten years, Alfredo knows the technology will become old quickly, and so they plan to replace...
-
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.
-
Taking into account differential labor costs abroad, transportation, tax advantages, and so forth, U. S. corporations can maximize long-run profits. There are also nonprofit behavioral and strategic...
-
When money is tight, interest rates are generally high. This means that near-cash assets have high returns; hence, it is expensive to hold idle cash balances. Firms tend to economize on their cash...
-
a. Better synchronization of cash inflows and outflows would allow the firm to keep its transactions balance at a minimum, and would therefore lower the target cash balance. b. Improved sales...
Study smarter with the SolutionInn App