What is wrong in the following program?
class Test {
public static void main (String[] args) {
try {
System.out.println("Welcome to Java");
}
}
}

day 9-exception handling

Quiz
•
Professional Development
•
Professional Development
•
Medium
Nirmala Sherine
Used 2+ times
FREE Resource
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
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
Similar Resources on Quizizz
7 questions
Kotlin Fundamentals

Quiz
•
Professional Development
5 questions
Java BootCamp

Quiz
•
Professional Development
10 questions
Connectors

Quiz
•
University - Professi...
10 questions
PreTrainingClassesObjectsMethods

Quiz
•
Professional Development
9 questions
PreTrainingJavaScript

Quiz
•
Professional Development
10 questions
OOPS Slot C1 Quiz Module5 and 6

Quiz
•
Professional Development
10 questions
Contract Law

Quiz
•
Professional Development
8 questions
OBR: Interference or Obstruction

Quiz
•
Professional Development
Popular Resources on Quizizz
25 questions
Equations of Circles

Quiz
•
10th - 11th Grade
30 questions
Week 5 Memory Builder 1 (Multiplication and Division Facts)

Quiz
•
9th Grade
33 questions
Unit 3 Summative - Summer School: Immune System

Quiz
•
10th Grade
10 questions
Writing and Identifying Ratios Practice

Quiz
•
5th - 6th Grade
36 questions
Prime and Composite Numbers

Quiz
•
5th Grade
14 questions
Exterior and Interior angles of Polygons

Quiz
•
8th Grade
37 questions
Camp Re-cap Week 1 (no regression)

Quiz
•
9th - 12th Grade
46 questions
Biology Semester 1 Review

Quiz
•
10th Grade