Java Exception Handling Quiz

Java Exception Handling Quiz

University

20 Qs

quiz-placeholder

Similar activities

Exception Handling

Exception Handling

University

25 Qs

OOP - session 2.1 - JVM, Array, Stack

OOP - session 2.1 - JVM, Array, Stack

University

21 Qs

Final Java Quiz

Final Java Quiz

University

20 Qs

Python Functions and Error Handling

Python Functions and Error Handling

10th Grade - University

20 Qs

Java Exception Handling

Java Exception Handling

University

15 Qs

Templates,Exceptions,Inheritance in C++ Quiz

Templates,Exceptions,Inheritance in C++ Quiz

University

20 Qs

Java Quiz

Java Quiz

University

25 Qs

basic concepts of OOPS

basic concepts of OOPS

University

22 Qs

Java Exception Handling Quiz

Java Exception Handling Quiz

Assessment

Quiz

Computers

University

Hard

Created by

Von Magbitang

Used 3+ times

FREE Resource

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What happens if an exception is not caught in Java?

Program terminates normally

The program compiles but does not run

The program crashes with an error message

The exception is ignored

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of the following exception types must be handled explicitly?

NullPointerException

ArrayIndexOutOfBoundsException

ClassCastException

IOException

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

True or False: A finally block will execute even if an exception occurs in the try block.

True

False

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the output of the following code?
try {
int x = 5 / 0;
} catch (ArithmeticException e) {
System.out.println("Error");
}

Error

Compilation fails

No output

RuntimeException

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which statement is incorrect about exception handling?

catch block can have multiple exceptions

finally always runs

A try block must be followed by catch

Multiple catch blocks can be used

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

True or False: catch blocks are executed in order from specific to general exceptions.

True

False

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Given the following code, what will be printed?

try {

return 1;

} finally {

return 2;

}

1

2

Compilation error

Runtime error

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?