Object Oriented Programming - I (3140705) MCQs

MCQs of Exception Handling, I/O, abstract classes and interfaces

Showing 1 to 10 out of 38 Questions
1.
When does Exceptions in Java arises in code sequence?
(a) Run Time
(b) Compilation Time
(c) Can Occur Any Time
(d) None of the mentioned
Answer:

Option (a)

2.
Which of these keywords is not a part of exception handling?
(a) try
(b) finally
(c) thrown
(d) catch
Answer:

Option (c)

3.
Which of these keywords must be used to monitor for exceptions?
(a) try
(b) finally
(c) throw
(d) catch
Answer:

Option (a)

4.
Which of these keywords must be used to handle the exception thrown by try block in some rational manner?
(a) try
(b) finally
(c) throw
(d) catch
Answer:

Option (d)

5.
Which of these keywords is used to manually throw an exception?
(a) try
(b) finally
(c) throw
(d) catch
Answer:

Option (c)

6.
What will be the output of the following Java program?
    class exception_handling 
    {
        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) A
(b) B
(c) AC
(d) BC
Answer:

Option (d)

7.
Which of the following classes can catch all exceptions which cannot be caught?
(a) RuntimeException
(b) Error
(c) Exception
(d) ParentException
Answer:

Option (b)

8.
Which of the following is a super class of all exception type classes?
(a) Catchable
(b) RuntimeExceptions
(c) String
(d) Throwable
Answer:

Option (d)

9.
Which of the following keyword is used by calling function to handle exception thrown by called function?
(a) throws
(b) throw
(c) try
(d) catch
Answer:

Option (a)

10.
Which of the following handles the exception when a catch is not used?
(a) finally
(b) throw handler
(c) default handler
(d) java run time system
Answer:

Option (c)

Showing 1 to 10 out of 38 Questions