
java quiz on exception handling

Quiz
•
Computers
•
University
•
Hard
Anupam Yadav
Used 268+ times
FREE Resource
20 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
30 sec • 1 pt
Which of these keywords is not a part of exception handling?
try
finally
thrown
catch
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public class Foo
{
public static void main(String[] args)
{
try
{
return;
}
finally
{
System.out.println( "Finally" );
}
}
}
Finally
Compilation fails.
The code runs with no output
An exception is thrown at runtime.
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What will be the output of the program?
try
{
int x = 0;
int y = 5 / x;
}
catch (Exception e)
{
System.out.println("Exception");
}
catch (ArithmeticException ae)
{
System.out.println(" Arithmetic Exception");
}
System.out.println("finished");
finished
runtime error.
Compilation fails
Exception.
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
public class X
{
public static void main(String [] args)
{
try
{
badMethod();
System.out.print("A");
}
catch (Exception ex)
{
System.out.print("B");
}
finally
{
System.out.print("C");
}
System.out.print("D");
}
public static void badMethod()
{
throw new Error(); /* Line 22 */
}
}
ABCD
Compilation fails.
C is printed before exiting with an error message.
BC is printed before exiting with an error message
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
public class X
{
public static void main(String [] args)
{
try
{
badMethod();
System.out.print("A");
}
catch (RuntimeException ex) /* Line 10 */
{
System.out.print("B");
}
catch (Exception ex1)
{
System.out.print("C");
}
finally
{
System.out.print("D");
}
System.out.print("E");
}
public static void badMethod()
{
throw new RuntimeException();
}
}
BD
BDE
BD
DE
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
java.lang.NullPointerException is a
Error
runtime exception
Compile time exception
None
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
FileNotFoundException
Is a subclass/extends IOException
Is a Compile time exception
Found in java.io package
All
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Exception handling -oracle plsql

Quiz
•
University
19 questions
Java Basic 1 - Quiz

Quiz
•
8th Grade - University
20 questions
PL SQL

Quiz
•
University - Professi...
17 questions
5-mavzu

Quiz
•
University
20 questions
js_edu_wrap_up

Quiz
•
1st Grade - Professio...
20 questions
Review JavaScript

Quiz
•
11th Grade - University
20 questions
JDBC

Quiz
•
University
20 questions
Code Junction 4

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