
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
25 questions
ict5_mt_w5-6_q2

Quiz
•
12th Grade - University
20 questions
JAVA Basics Quiz

Quiz
•
University
20 questions
Quiz PBO SIA

Quiz
•
University
15 questions
Round 4 - Harvest

Quiz
•
University
20 questions
TALENT-NEXT-JAVA-QUIZ1

Quiz
•
University
17 questions
Lección1 - JavaScript

Quiz
•
1st Grade - Professio...
25 questions
PYTHON CONTERST 3

Quiz
•
University
20 questions
Geeks for Geeks PCCOER Info Session CP Quiz

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

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

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

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

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University