
Java Exception Handling Quiz

Quiz
•
Computers
•
University
•
Hard
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
Similar Resources on Wayground
15 questions
Code.org Quiz2

Quiz
•
7th Grade - University
15 questions
PL/SQL Procedures

Quiz
•
University
20 questions
Python Programming Quiz

Quiz
•
10th Grade - University
15 questions
Python Quiz - 25/09/2024

Quiz
•
University
17 questions
U1. Files and Serialization

Quiz
•
University
20 questions
CSS Quiz

Quiz
•
University
15 questions
Python Quiz 2

Quiz
•
University
23 questions
Secure Programming Practices

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
10 questions
The Constitution, the Articles, and Federalism Crash Course US History

Interactive video
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
16 questions
Water Modeling Activity

Lesson
•
11th Grade - University
10 questions
ACT English prep

Quiz
•
9th Grade - University