
Java I/O streams, Files and collection frameworks

Quiz
•
Computers
•
University
•
Hard
Benila S
FREE Resource
22 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following declarations don't compile?
A)List<?> l1 = new ArrayList<>();
B)List<String> l2 = new ArrayList();
C) List<? super Object> l3 = new ArrayList<String>();
D) List<? extends Object> l4 = new ArrayList<String>();
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public class Question {
public static void main(String[] args) {
Question q = new Question();
List<Integer> l = new ArrayList<>();
l.add(20); l.add(30); q.m1(l); }
private void m1(List<?> l) { m2(l); // 1 }
private <T> void m2(List<T> l)
{ l.set(1, l.get(0)); // 2
System.out.println(l);
}
}
A) [20, 20]
B) Compilation fails on the line marked as // 1
C) Compilation fails on the line marked as // 2
D) An exception occurs at runtime
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public class Question <T extends Number> {
T t;
public static void main(String[] args) {
Question q = new Question<Integer>(); // 1
q.t = new Float(1); // 2
System.out.println(q.t);
}
}
A. 1.0
B. Compilation fails on the line marked as // 1
C. Compilation fails on the line marked as // 2
D. An exception occurs at runtime
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
import java.util.*;
class UtilitiesTest {
public static void main(String[] args) {
List < int > intList = new ArrayList < > ();
intList.add(10);
intList.add(20);
System.out.println("The list is: " + intList);
A) It prints the following: The list is: [10, 20]
B) It prints the following: The list is: [20, 10]
C. It results in a compiler error
D. It results in a runtime exception
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which interface represents a resizable array of objects in Java Collections?
a) Set
b) List
c) Map
d) Queue
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of these is not a method defined in the Map interface?
a) put()
b) get()
c) remove()
d) add()
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of these interfaces is not part of the Java Collections Framework?
d) Sortable
a) List
b) SortedMap
c) SortedSet
d) Sortable
Create a free account and access millions of resources
Similar Resources on Wayground
21 questions
quiz 2nd/3rd year

Quiz
•
University
20 questions
Insert, Delete data & using Images

Quiz
•
University
20 questions
MTA: 98-367 Security Part 1

Quiz
•
KG - Professional Dev...
22 questions
EXCEPTION HANDLING IN PYTHON

Quiz
•
University
18 questions
JS/DOM/JQuery/HTML/CSS

Quiz
•
University
25 questions
JAVA WEEK 7-12

Quiz
•
University
20 questions
java quiz on exception handling

Quiz
•
University
20 questions
TEKNOLOGI INFORMASI DAN KOMUNIKASI

Quiz
•
12th Grade - University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Would you rather...

Quiz
•
KG - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

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

Interactive video
•
4th Grade - University
10 questions
The Constitution, the Articles, and Federalism Crash Course US History

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

Interactive video
•
4th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
16 questions
Water Modeling Activity

Lesson
•
11th Grade - University
10 questions
ACT English prep

Quiz
•
9th Grade - University