My Report

Java Exception Handling Test – 3


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. Which of these handles the exception when no catch is used?

2. Which of these class is related to all the exceptions that can be caught by using catch?

3. Which of these is a super class of all exceptional type classes?

4. What will be the output of the following Java code?

 
    class exception_handling 
    {
        public static void main(String args[]) 
        {
            try 
            {
                System.out.print("Hello" + " " + 1 / 0);
            }
            finally 
            {
        	System.out.print("World");        	
            }
        }
    }

5. What exception thrown by parseInt() method?

6. What will be the output of the following Java code?

 
    class exception_handling 
    {
        public static void main(String args[]) 
        {
            try 
            {
                int i, sum;
                sum = 10;
                for (i = -1; i < 3 ;++i) 
                {
                    sum = (sum / i);
                System.out.print(i);
                }
            }
            catch(ArithmeticException e) 
            {     	
                System.out.print("0");
            }
        }
    }

7. Which of these class is related to all the exceptions that cannot be caught?


 

Start practicing “1000 MCQs on Java”, and once you are ready, you can take tests on all topics by attempting our “Java Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
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 & discussions at Telegram SanfoundryClasses.