17 questions
What is the advantage of Exception Handling
To avoid abnormal termination of a program
To find out errors
To Debug program
None of these
What is the parent class of All Exceptions in JAVA
Throw
Exception
Error
Bug
Which of the following key word is optional in Exception handling program
try
catch
finally
throw
try block may or may not contains catch blocks
True
False
What is the purpose of 'throw' keyword
To Raise an exception explicityly
To Raise an exception implicityly
To create user defined exceptions
To create custom exceptions
What is an exception
Error occurred during the execution of a program
Bug occurred during the compile time of a program
Simply an Error
It is related to input values
How to create our own exception
using 'throw' keyword
using 'throws' keyword
using 'finally' keyword
using 'throwable' keyword
Exception classes belongs to following package
import java.io.*
import java.lang.*
import java.util.*
import java.lang.Exception.*
Which of these keywords is not a part of exception handling?
try
finally
thrown
catch
java.lang.NullPointerException is a
Error
runtime exception
Compile time exception
None
Which of these class is highest in hierarchy in java
java.lang.Exception
java.lang.Error
java.lang.Throwable
java.lang.Object
Choose the CORRECT exception
String department="JTMK";
Integer no=Integer.parseInt(department);
ArithmeticException
NullPointerException
NumberFormatException
ArrayIndexOutOfBoundsException
Choose an exception if attempt to divide number by zero
int number = 89 / 0;
System.out.println("The answer is " + number);
ArithmeticException
NullPointerException
NumberFormatException
ArrayIndexOutOfBoundException
What will it print?
1
2
3
30
1
2
30
1
2
3
11
1
2
11
Which line or lines should we get inside a try block to avoid errors?
3
4
6
2
What will this print?
There was an error
1
9
0
What will this program print?
Nothing, there is an error
There was a ValueError, please try again