TOTAL QS = 27Time [ 00 : 00 : 00 ]
00:00:00

Java Exception Handling Basics Online Practice Test 1

Instructions

Total Questions: 27

Total Minutes: 27

This ExamTray Free Online Test or Quiz or Trivia tests your Programming Skills on the basics of Java Exception Handling. This practice test displays answers after finishing the exam for review. You can easily clear Competitive Exams and Job Interview Questions. Students can learn Java basics.

Go through Java Theory Notes on Exception Handling before attempting this test.

All the Best

Challenge SCORE

0 / 27

Take This Exam
1) What is an Exception in Java?
2) All Java exceptions can be handled gracefully. State TRUE or FALSE.
3) Are the classes Error and Exception similar in Java?
4) Which is the super class in Java that bundles all classes to deal with exceptions and errors?
5) Which are the keywords used to handle exceptions in Java?
6) Where should you keep your Java code for checking against runtime exceptions?
7) Where should you keep your Java code that helps to take action on the exceptions raised inside TRY block?
8) What is the output of the below Java code with Exceptions?
public class ExceptionTest1
{
  public static void main(String[] args)
  {
    try
    {
      int a=9, b=0;
      int c = a/b;
      System.out.println("Exception occurred.");
    }
    catch(Exception e)
    {
      System.out.println("Catching an Exception.");
    }
  }
}
9) If an exception occurs, all the lines of Java code that is below it stops executing. State TRUE or FALSE. 
10) Java exceptions are handled by ____.
11) Can you add more than one CATCH block when handling exceptions in Java?
12) A TRY block is the reason for generating a manual exception or an unexpected Runtime exception. State TRUE or FALSE. 
13) What is the output of the below Java code with Exceptions?
public class ExceptionTest2
{
  public static void main(String[] args)
  {
    try
    {
      int ary[] = {10, 20, 30};
      int tempt = ary[4];
    }
    catch(ArrayIndexOutOfBoundsException e1)
    {
      System.out.println(e1.getMessage());
    }
    catch(Exception e2)
    {
      System.out.println("Some exception");
    }
  }
}
14) Choose the correct way of writing multiple CATCH blocks in Java.
15) Where do you keep the Java code that should be executed at all times even if an exception occurs?
16) What is the output of the below java code with exception handling blocks?
public class ExceptionTest4
{
  public static void main(String[] args)
  {
    try
    {
    }
    catch(Exception e)
    {
    }
    finally
    {
      System.out.println("FINALLY block executed");
    }
  }
}
17) What is the output of the below Java code with exception handling blocks?
public class ExceptionTest5
{
  public static void main(String[] args)
  {
    int ary[] = new int[2];
    ary[10] = 5;
    try
    {
      int number= 2/0;
    }
    catch(Exception e)
    {
      System.out.println("Divide by Zero");
    }
    finally
    {
      System.out.println("Inside FINALLY block");
    }
  }
}
18) What is the output of the Java code with FINALLY block and RETURN statement?
public class ExceptionTest6
{
  static void show()
  {
    try
    {
    System.out.println("inside TRY");
    return;
    }
    finally
    {
    System.out.println("inside FINALLY");
    }
  }
  public static void main(String[] args)
  {
    show();
  }
}
19) Choose the correct way of writing TRY CATCH FINALLY blocks in Java.
20) The FINALLY block should always be accompanied by a ___ block in Java.
21) The CATCH block should always be accompanied by a ____ block in Java.
22) How many extra TRY blocks may be present with an existing TRY block in Java?
23) How many CATCH blocks may be present in try-catch-finally series of blocks in Java?
24) What is an Unchecked Exception in Java?
25) What is a Checked Exception in Java?
26) Choose which are Java unchecked exceptions below?
27) Choose which are Java checked exceptions below?
Certification Group ID
0

Open Certification Helper Popup Reset Popup