Sail E0 Webinar

MCQs

Total Questions : 23 | Page 1 of 3 pages
Question 1. The class at the top of exception class hierarchy is .................
  1.    Exception
  2.    Object
  3.    ArithmeticException
  4.    Throwable
 Discuss Question
Answer: Option D. -> Throwable
Question 2. Exception generated in try block is caught in ........... block.
  1.    catch
  2.    throws
  3.    throw
  4.    finally
 Discuss Question
Answer: Option A. -> catch
Question 3. Which keyword is used to explicitly throw an exception?
  1.    throwing
  2.    throw
  3.    try
  4.    catch
 Discuss Question
Answer: Option B. -> throw
Question 4. Which exception is thrown when divide by zero statement executes?
  1.    ArithmeticException
  2.    NullPointerException
  3.    NumberFormatException
  4.    None of these
 Discuss Question
Answer: Option A. -> ArithmeticException
Question 5. In which of the following package Exception class exist?
  1.    java.file
  2.    java.net
  3.    java.lang
  4.    java.io
  5.    java.util
 Discuss Question
Answer: Option C. -> java.lang
Question 6. Which keyword is used to specify the exception thrown by method?
  1.    throws
  2.    throw
  3.    finally
  4.    catch
 Discuss Question
Answer: Option A. -> throws
Question 7. What is the output of the following program code?public class Test{ public static void main(String args[]){ try{ int i; return; } catch(Exception e){ System.out.print("inCatchBlock"); } finally{ System.out.println("inFinallyBlock"); } }}
  1.    inCatchBlock
  2.    inCatchBlock inFinallyBlock
  3.    The program will return without printing anything
  4.    inFinallyBlock
 Discuss Question
Answer: Option D. -> inFinallyBlock
Question 8. Which of the following blocks execute compulsorily whether exception is caught or not.
  1.    catch
  2.    throws
  3.    throw
  4.    finally
 Discuss Question
Answer: Option D. -> finally
Question 9. Which exception is thrown when an array element is accessed beyond the array size?
  1.    ArrayIndexOutOfBounds
  2.    ArrayElementOutOfBounds
  3.    None of these
  4.    ArrayIndexOutOfBoundsException
 Discuss Question
Answer: Option D. -> ArrayIndexOutOfBoundsException
Question 10. What happen in case of multiple catch blocks?
  1.    Either super or subclass can be caught first.
  2.    None of these
  3.    The superclass exception cannot caught first.
  4.    The superclass exception must be caught first.
 Discuss Question
Answer: Option C. -> The superclass exception cannot caught first.

Latest Videos

Latest Test Papers