Exceptions


  1. What is the output of this program?
    public class Arithmetic_Exception
    {
    public static void main(String args[])
    {
    try
    {
    int p = args.length;
    int q = 11 / p;
    System.out.print(p);
    }
    catch (ArithmeticException e)
    {
    System.out.println("First");
    }
    }
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    First


  1. What is the use of try & catch?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    *It allows to fix errors.
    *It prevents automatic terminating of the program in cases when an exception occurs
    *It allows us to manually handle the exception



  1. Which of these keywords are used for the block to be examined for exceptions?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    try is used for the block that needs to checked for exception.


  1. Which of these keywords are used for the block to handle the exceptions generated by try block?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    catch



  1. Which of these keywords are used for generating an exception manually?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    throw