
day 9-exception handling
Authored by Nirmala Sherine
Professional Development
Professional Development
Used 2+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is wrong in the following program?
class Test {
public static void main (String[] args) {
try {
System.out.println("Welcome to Java");
}
}
}
You cannot have a try block without a catch block.
You cannot have a try block without a catch block or a finally block.
A method call that does not declare exceptions cannot be placed inside a try block.
Nothing is wrong.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is displayed on the console when running the following program?
class Test {
public static void main (String[] args) {
try {
System.out.println("Welcome to Java");
}
finally {
System.out.println("The finally clause is executed");
}
}
}
Welcome to Java
Welcome to Java followed by The finally clause is executed in the next line
The finally clause is executed
None of the above
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of executing the following code, using the parameters 4 and 0:
public void divide(int a, int b) {
try {
int c = a / b;
} catch (Exception e) {
System.out.print("Exception ");
} finally {
System.out.println("Finally");
}
Prints out: Exception Finally
Prints out: Finally
Prints out: Exception
No output
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The class java.lang.Exception
is public
implements Throwable
extends Throwable
is serializable
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of these is a legal definition of a method named m assuming it throws IOException, and returns void. Also assume that the method does not take any arguments. Select the one correct answer.
void m() throws IOException{}
void m() throw IOException{}
void m(void) throws IOException{}
m() throws IOException{}
void m() {} throws IOException
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
RETUR
Quiz
•
Professional Development
10 questions
Understanding Educational Theories
Quiz
•
Professional Development
10 questions
Cold Water Systems Quiz L2 2.8 Part3
Quiz
•
Professional Development
10 questions
+/- Reinforcement & Punishment
Quiz
•
Professional Development
10 questions
TOEFL ERROR ANALYSIS / WRITTEN EXPRESSION
Quiz
•
10th Grade - Professi...
10 questions
BEGINNING A PRESENTATION
Quiz
•
10th Grade - Professi...
10 questions
Ivy_Honeywell_Data Analytics_6.1
Quiz
•
Professional Development
10 questions
WCF Day-11 Servlets and JSP
Quiz
•
Professional Development
Popular Resources on Wayground
8 questions
Spartan Way - Classroom Responsible
Quiz
•
9th - 12th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
14 questions
Boundaries & Healthy Relationships
Lesson
•
6th - 8th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
3 questions
Integrity and Your Health
Lesson
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
9 questions
FOREST Perception
Lesson
•
KG
20 questions
Main Idea and Details
Quiz
•
5th Grade
Discover more resources for Professional Development
15 questions
LOTE_SPN2 5WEEK3 Day 2 Itinerary
Quiz
•
Professional Development
6 questions
Copy of G5_U6_L5_22-23
Lesson
•
KG - Professional Dev...
10 questions
March Quiz
Quiz
•
Professional Development
5 questions
Copy of G5_U6_L8_22-23
Lesson
•
KG - Professional Dev...
10 questions
suffixes FUL OR LESS
Quiz
•
Professional Development