
Java Collections Quiz

Quiz
•
Other
•
University
•
Hard

Niveditha N
Used 1+ times
FREE Resource
11 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which Java collection class is most suitable to represent a shopping cart where items can be accessed by index and duplicates are allowed?
HashSet
HashMap
ArrayList
TreeSet
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In a school attendance system where each student should be marked present only once, which collection would you use?
ArrayList
HashSet
TreeMap
Stack
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
You are building a dictionary application where each word maps to its meaning. Which collection is best suited?
LinkedList
Stack
HashMap
TreeSet
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which collection would you use to store a list of students in the order of registration, without allowing duplicates?
TreeMap
LinkedHashSet
PriorityQueue
Hashtable
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following?
List list = new ArrayList<>();
list.add("A"); list.add("B"); list.add("A");
Set set = new HashSet<>(list);
System.out.println(set.size());
2
3
Compilation Error
Runtime Exception
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of this code? List list = new ArrayList<>(); list.add("A"); list.add("B"); list.add(1, "C"); System.out.println(list);
[A, B, C]
[A, C, B]
[C, A, B]
Compilation Error
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider this code: List list = Arrays.asList(1, 2, 3, 4, 5); list.set(2, 10); System.out.println(list);
[1, 2, 10, 4, 5]
[1, 10, 3, 4, 5]
Compilation Error
Runtime Exception
Create a free account and access millions of resources
Similar Resources on Wayground
10 questions
POST TEST MODULE 4

Quiz
•
University
10 questions
DD#3

Quiz
•
University
12 questions
Searching Quiz

Quiz
•
University
15 questions
Data Structure & Algorithm

Quiz
•
University
10 questions
STEM Innovator® Analyzing Data Terms

Quiz
•
9th Grade - Professio...
10 questions
Java set3

Quiz
•
University
16 questions
Qualitative research

Quiz
•
University
9 questions
Javascript Course 2022

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
Appointment Passes Review

Quiz
•
6th - 8th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
Grammar Review

Quiz
•
6th - 9th Grade
Discover more resources for Other
15 questions
Disney Trivia

Quiz
•
University
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
7 questions
What Is Narrative Writing?

Interactive video
•
4th Grade - University
20 questions
Disney Trivia

Quiz
•
University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
5 questions
Examining Theme

Interactive video
•
4th Grade - University
23 questions
Lab 4: Quizziz Questions

Quiz
•
University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University