What is the output of this program?
class exception_handling
{
public static void main(String args[])
{
try
{
System.out.print("Hello" + " " + 1 / 0);
}
catch(ArithmeticException e)
{
System.out.print("World");
}
}
}
Hello
World
HelloWorld
Hello World
SHOW ANSWERWhat is the output of this program?
class exception_handling
{
public static void main(String args[])
{
try
{
int a, b;
b = 0;
a = 5 / b;
System.out.print("A");
}
catch(ArithmeticException e)
{
System.out.print("B");
}
}
}
A
B
Compilation Error
Runtime Error
SHOW ANSWERWhat is the output of this program?
class exception_handling{
public static void main(String args[]) {
try
{
int a, b;
b = 0;
a = 5 / b;
System.out.print("A");
}
catch(ArithmeticException e)
{
System.out.print("B");
}
finally
{
System.out.print("C");
}
}
}
A
B
AC
BC
SHOW ANSWERWhat is the output of this program?
class exception_handling
{
public static void main(String args[])
{
try
{
int i, sum;
sum = 10;
for (i = -1; i < 3 ;++i)
sum = (sum / i);
}
catch(ArithmeticException e)
{
System.out.print("0");
}
System.out.print(sum);
}
}
0
05
Compilation Error
Runtime Error
SHOW ANSWERWhich of the following keywords is used for throwing exception manually?
finally
try
throw
catch
SHOW ANSWERWhich of the following classes can catch all exceptions which cannot be caught?
RuntimeException
Error
Exception
ParentException
SHOW ANSWERWhich of the following is a super class of all exception type classes?
Catchable
RuntimeExceptions
String
Throwable
SHOW ANSWERWhich of the following operators is used to generate instance of an exception which can be thrown using throw?
thrown
alloc
new
malloc
SHOW ANSWERWhich of the following keyword is used by calling function to handle exception thrown by called function?
throws
throw
try
catch
SHOW ANSWERWhich part of code gets executed whether exception is caught or not?
finally
try
catch
throw
SHOW ANSWERAn expression involving byte, int, and literal numbers is promoted to which of these?
int
long
byte
float
SHOW ANSWERWhich data type value is returned by all transcendental math functions?
int
float
double
long
SHOW ANSWERWhat is the output of this program?
class increment {
public static void main(String args[])
{
int g = 3;
System.out.print(++g * 8);
}
}
25
24
32
33
SHOW ANSWER