61. What will be the output of the following Java code?
class Output
{
public static void main(String args[])
{
try
{
int a = 0;
int b = 5;
int c = b / a;
System.out.print("Hello");
}
}
}
class Output
{
public static void main(String args[])
{
try
{
int a = 0;
int b = 5;
int c = b / a;
System.out.print("Hello");
}
}
}
62. Which of these class is related to all the exceptions that cannot be caught?
63. Which of these classes is used to define exceptions?
64. Which of these class is related to all the exceptions that can be caught by using catch?
65. What will be the output of the following Java code?
class exception_handling
{
public static void main(String args[])
{
try
{
System.out.print("Hello" + " " + 1 / 0);
}
finally
{
System.out.print("World");
}
}
}
class exception_handling
{
public static void main(String args[])
{
try
{
System.out.print("Hello" + " " + 1 / 0);
}
finally
{
System.out.print("World");
}
}
}
66. Which of these classes is super class of Exception class?
67. What will be the output of the following Java code?
class exception_handling
{
public static void main(String args[])
{
try
{
int a = args.length;
int b = 10 / a;
System.out.print(a);
try
{
if (a == 1)
a = a / a - a;
if (a == 2)
{
int []c = {1};
c[8] = 9;
}
}
catch (ArrayIndexOutOfBoundException e)
{
System.out.println("TypeA");
}
catch (ArithmeticException e)
{
System.out.println("TypeB");
}
}
}
Note: Execution command line: $ java exception_handling one two
class exception_handling
{
public static void main(String args[])
{
try
{
int a = args.length;
int b = 10 / a;
System.out.print(a);
try
{
if (a == 1)
a = a / a - a;
if (a == 2)
{
int []c = {1};
c[8] = 9;
}
}
catch (ArrayIndexOutOfBoundException e)
{
System.out.println("TypeA");
}
catch (ArithmeticException e)
{
System.out.println("TypeB");
}
}
}
Note: Execution command line: $ java exception_handling one two
68. Which of these statements is incorrect?
69. Which of these keywords are used for the block to handle the exceptions generated by try block?
70. Which of these keywords must be used to monitor for exceptions?
Read More Section(Exceptions)
Each Section contains maximum 100 MCQs question on Exceptions. To get more questions visit other sections.