Sail E0 Webinar

MCQs

Total Questions : 61 | Page 1 of 7 pages
Question 1. The class at the top of exception class hierarchy is .................
  1.    ArithmeticException
  2.    Throwable
  3.    Object
  4.    Exception
 Discuss Question
Answer: Option B. -> Throwable
Question 2. In which of the following package Exception class exist?
  1.    java.util
  2.    java.file
  3.    java.io
  4.    java.lang
  5.    java.net
 Discuss Question
Answer: Option D. -> java.lang
Question 3. Which keyword is used to explicitly throw an exception?
  1.    try
  2.    throwing
  3.    catch
  4.    throw
 Discuss Question
Answer: Option D. -> throw
Question 4. Exception generated in try block is caught in ........... block.
  1.    catch
  2.    throw
  3.    throws
  4.    finally
 Discuss Question
Answer: Option A. -> catch
Question 5. Which exception is thrown when divide by zero statement executes?
  1.    NumberFormatException
  2.    ArithmeticException
  3.    NullPointerException
  4.    None of these
 Discuss Question
Answer: Option B. -> ArithmeticException
Question 6. Which keyword is used to specify the exception thrown by method?
  1.    catch
  2.    throws
  3.    finally
  4.    throw
 Discuss Question
Answer: Option B. -> throws
Question 7. Which of the following blocks execute compulsorily whether exception is caught or not.
  1.    finally
  2.    catch
  3.    throws
  4.    throw
 Discuss Question
Answer: Option A. -> finally
Question 8. What happen in case of multiple catch blocks?
  1.    Either super or subclass can be caught first.
  2.    The superclass exception must be caught first.
  3.    The superclass exception cannot caught first.
  4.    None of these
 Discuss Question
Answer: Option C. -> The superclass exception cannot caught first.
Question 9. 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.    inFinallyBlock
  4.    The program will return without printing anything
 Discuss Question
Answer: Option C. -> inFinallyBlock
Question 10. Which exception is thrown when an array element is accessed beyond the array size?
  1.    ArrayElementOutOfBounds
  2.    ArrayIndexOutOfBoundsException 
  3.    ArrayIndexOutOfBounds
  4.    None of these
 Discuss Question
Answer: Option B. -> ArrayIndexOutOfBoundsException 

Latest Videos

Latest Test Papers