Which statement is true?A. A try statement must have at least one corresponding catch block.B. Multiple catch statements can catch the same class of exception more than once.C. Except in case of VM shutdown, if a try block starts to execute, a corresponding finally block will always start to execute.D. An Error that might be thrown in a method must be declared as thrown by that method, or be handled within that method.Question 2AnswerACDB
Question
Which statement is true?A. A try statement must have at least one corresponding catch block.B. Multiple catch statements can catch the same class of exception more than once.C. Except in case of VM shutdown, if a try block starts to execute, a corresponding finally block will always start to execute.D. An Error that might be thrown in a method must be declared as thrown by that method, or be handled within that method.Question 2AnswerACDB
Solution
I'm sorry, but you didn't provide any text for me to respond to. Could you please provide the text?
Similar Questions
Which of the following should be within a catch block?d) Throws keywordc) any number of statements to handle Exceptiona) finally blockb) Single statement that handles Exception
Which of the following statements about the finally block in exception handling is true?Question 8Answera.The finally block is executed only when an exception occurs.b.The finally block is executed only when there is no exception.c.The finally block is executed regardless of whether an exception occurs or not.d.The finally block is optional and can be excluded from the try-catch structure.
Which of the following should immediately follow ‘try’ block to handle an exception? finally catch else except
Which of these keywords is not a part of exception handling?a) tryb) finallyc) thrownd) catch
1. The closest common ancestor of RuntimeException, Error, IOException and ClassNotFoundException is:*A. A.ObjectB. ExceptionC. ThrowableD. Catchable2. A method that potentially generates a checked exception must include this keyword in its method signature:*A. throwB. extendC. throwsD. extends3. Which of the following statements is true about Java's finally block?*A. The finally block is only executed if an exception is thrown in the try blockB. The finally block is only executed if an exception is thrown in the catch blockC. The finally block is only executed if an exception is not thrown in the try or catch blockD. The finally block is executed regardless of whether an exception is thrown in the try or catch block4. If code is structured to handle the IOException before the FileNotFoundException, which of these results is true?*A. Both IOException and FileNotFoundException handling routines will runB. Only the IOException handling routine will runC. Only the FileNotFoundException handling routine will runD. The code will not compile5. Which keyword raises an exception in Java code?*A. tryB. throwC. breakD. throws6. A JVM level problem that terminates the current runtime is a subtype of:*A. RuntimeExceptionB. ExceptionC. FatalExceptionD. Error7. Which of the following statements is true about exception handling in Java:*A. A try block can have many catch blocks but only one finally blockB. A try block can have many catch blocks and many finally blocksC. A try block must have one finally block for each catch blockD. A try block must have at least one catch block to have a finally block8. class Base extends Exception {}class Derived extends Base {}public class Main { public static void main(String args[]) { // some other stuff try { // Some monitored code throw new Derived(); } catch(Base b) { System.out.println("Caught base class exception"); } catch(Derived d) { System.out.println("Caught derived class exception"); } }} *A. Caught derived class exceptionB. Compiler Error because derived is not throwableC. Compiler Error because base class exception is caught before derived classD. Caught base class exception.9. class Test { public static void main(String args[ ]) { try { System.out.print("Hello" + " " + 1 / 0); } catch(ArithmeticException e) { System.out.print("World"); } } }*a) Hellob) Worldc) HelloWorldd) Hello World10. What will be the output of the following Java program? class Test { public static void main(String args[ ]) { try { int a, b; b = 0; a = 5 / b; System.out.print("A"); } catch(ArithmeticException e) { System.out.print("B"); } finally { System.out.print("C"); } } }a) Ab) Bc) ACd) BC11. What will be the output of the following Java program? class Test { public static void main(String args[ ]) { try { int i, sum; sum = 10; for (i = -1; i < 3 ;++i) sum = (sum / i); } catch(ArithmeticException e) { System.out.print("0"); } System.out.print(sum); } }*a) 0b) 05c) Compilation Errord) Runtime Error12. What will happen if two thread of the same priority are called to be processed simultaneously?*a) Anyone will be executed first lexographicallyb) Both of them will be executed simultaneouslyc) None of them will be executedd) It is dependent on the operating system13. Which of these is not a Thread state?*A. NewB. RunnableC. sleepD. terminated14. What state does Thread enter in when it has been created and started?*A. NewB. RunnableC. RunningD. Waiting15. What is difference between starting thread with run() and start() method?*A. There is no differenceB. When you call start() method, main thread internally calls run() method to start newly created ThreadC. run() calls start() method internallyD. None16. Which of these is valid about threads in java*A. Thread behaviour is unpredictableB. execution of Threads depends on Thread schedulerC. Same threading program may produce different output in subsequent executions even on same platformD. All17. What is valid about threads*A. Threads have their own heap allocated area.B. Threads have their own stack.C. Threads doesn't have own stack.D. Threads doesn't have own stack.18. Which method can be used to find whether Thread hasn't entered dead state?*A. isAlive()B. isRunning()C. isNotDeadD. All19. In java multi-threading, a thread can be created by*A. Extending Thread classB. Implementing Runnable interfaceC. Using bothD. None20. What is maximum thread priority in Java*A. 10B. 12C. 5D. 8
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.