
Exception handling2

Quiz
•
Professional Development
•
1st Grade
•
Hard
khushbu mehta
Used 5+ times
FREE Resource
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.
Similar Resources on Wayground
10 questions
Forecast & ES 小博士

Quiz
•
1st Grade
10 questions
GAM 2020

Quiz
•
1st - 3rd Grade
10 questions
Process Technology

Quiz
•
1st Grade
10 questions
FREE FIRE

Quiz
•
1st Grade - Professio...
9 questions
Workbook Management Facts

Quiz
•
KG - 9th Grade
10 questions
RPMS

Quiz
•
KG - University
10 questions
Voice Cases

Quiz
•
1st Grade
10 questions
6310 revision A & B

Quiz
•
1st - 5th Grade
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 Professional Development
18 questions
D189 1st Grade OG 1c Concept 37-38

Quiz
•
1st Grade
20 questions
addition

Quiz
•
1st - 3rd Grade
20 questions
Subject and predicate in sentences

Quiz
•
1st - 3rd Grade
20 questions
Addition and Subtraction facts

Quiz
•
1st - 3rd Grade
20 questions
Place Value

Quiz
•
KG - 3rd Grade
10 questions
Exploring Properties of Matter

Interactive video
•
1st - 5th Grade
5 questions
Life at a pond

Quiz
•
1st Grade
14 questions
Plural Nouns Adding s and es

Quiz
•
1st - 2nd Grade