
Exception handling2
Authored by khushbu mehta
Professional Development
1st Grade
Used 5+ 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 • 5 pts
Which of the following are checked exceptions?
class One extends RuntimeException{}
class Two extends Exception{}
class Three extends Error{}
class Four extends One{}
oneone
two
Three
Four
2.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
01 Given:
34. HashMap props = new HashMap();
35. props.put("key45", "some value");
36. props.put("key12", "some other value");
37. props.put("key39", "yet another value");
38. Set s = props.keySet();
39. // insert code here
Arrays.sort(s);
s = new TreeSet(s);
Collections.sort(s);
s = new SortedSet(s);
3.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Given:
23. Object [] myObjects = {
24. new Integer(12),
25. new String("foo"),
26. new Integer(5),
27. new Boolean(true)
28. };
29. Arrays.sort(myObjects);
30. for(int i=0; i<myObjects.length; i++) {
31. System.out.print(myObjects[i].toString());
32. System.out.print(" ");
33. }
Compilation fails due to an error in line 23.
Compilation fails due to an error in line 29.
A ClassCastException occurs in line 29.
The value of all four objects prints in natural order.
4.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Given:
1. import java.util.*;
2. public class Example {
3. public static void main(String[] args) {
4. // insert code here
5. set.add(new Integer(2));
6. set.add(new Integer(1));
7. System.out.println(set);
8. }
9. }
Which code, inserted at line 4, guarantees that this program will output [1, 2]?
A. Set set = new TreeSet();
B. Set set = new HashSet();
List set = new SortedList();
Set set = new LinkedHashSet();
5.
MULTIPLE CHOICE QUESTION
30 sec • 5 pts
Q: 09 Given:
11. public static Collection get() {
12. Collection sorted = new LinkedList();
13. sorted.add("B"); sorted.add("C"); sorted.add("A");
14. return sorted;
15. }
16. public static void main(String[] args) {
17. for (Object obj: get()) {
18. System.out.print(obj + ", ");
19. }
20. }
What is the result?
A, B, C,
B, C, A,
Compilation fails.
An exception is thrown at runtime.
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
Day-05 Installation follow UP
Quiz
•
1st Grade
10 questions
Fake news
Quiz
•
1st - 10th Grade
10 questions
UNIT 6: REKA BENTUK PENGATURCARAAN
Quiz
•
1st Grade
10 questions
Welcome Back To School with Nearpod!
Quiz
•
KG - 5th Grade
10 questions
CommQuest - Business Quiz - Rapid Fire Round
Quiz
•
1st - 3rd Grade
10 questions
DBMS Quiz 3
Quiz
•
1st - 10th Grade
10 questions
Carpets Product Knowledge Quiz
Quiz
•
1st - 2nd Grade
10 questions
AO SDIC Non-EXEC
Quiz
•
1st Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
Discover more resources for Professional Development
20 questions
Telling Time to the Hour and Half hour
Quiz
•
1st Grade
10 questions
Life Cycle of a Frog
Quiz
•
1st - 2nd Grade
10 questions
Exploring Rosa Parks and Black History Month
Interactive video
•
1st - 5th Grade
20 questions
Place Value
Quiz
•
KG - 3rd Grade
10 questions
100th Day of School 1st/2nd
Quiz
•
1st - 2nd Grade
15 questions
Reading Comprehension
Quiz
•
1st - 5th Grade
10 questions
Identifying Physical and Chemical Changes
Interactive video
•
1st - 5th Grade
10 questions
Exploring the American Revolution
Interactive video
•
1st - 5th Grade