This section of our 1000+ Java MCQs focuses on exception handling of Java Programming Language. Show 1. When does Exceptions in Java arises in code sequence? Answer: a 2. Which of these keywords is not a part of exception handling? Answer: c 3. Which of these keywords must be used to monitor for exceptions? Answer: a 4. Which of these keywords must be used to handle the exception thrown by try block in some rational manner? Answer: d 5. Which of these keywords is used to manually throw an exception? Answer: c 6. What will be the output of the following Java program?
a) Hello Answer: b $ javac exception_handling.java
$ java exception_handling
World 7. What will be the output of the following Java program?
a) A Answer: b $ javac exception_handling.java
$ java exception_handling
B 8. What will be the output of the following Java program?
a) A Answer: d $ javac exception_handling.java
$ java exception_handling
BC 9. What will be the output of the following Java program?
a) 0 Answer: c $ javac exception_handling.java Exception in thread "main" java.lang.Error: Unresolved compilation problem: sum cannot be resolved to a variable Sanfoundry Global Education & Learning Series – Java Programming Language. Next Steps:
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn. Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses. Which is invalid about throws in exception handling in Java?Which is invalid about throws in Exception handling in java? b. throws can be used to throw multiple exception at time.
What is invalid exception in Java?The IllegalArgumentException is an unchecked exception in Java that is thrown to indicate an illegal or unsuitable argument passed to a method. It is one of the most common exceptions that occur in Java.
Which of these points will be invalid if superclass method does not throw an exception?Rule 1: If the superclass method does not declare an exception, subclass overridden method cannot declare the checked exception.
Which of the following is not a valid exception class in Java?1 Answer. The correct answer to the question “Which of the following is NOT a . NET Exception class” is, option (a). StackMemoryException.
|