
Java Collections Quiz
Quiz
•
Other
•
University
•
Practice Problem
•
Hard
Niveditha N
Used 1+ times
FREE Resource
Enhance your content in a minute
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
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
TOPIC 1 - INTRODUCTION TO BUSINESS ETHICS
Quiz
•
University
15 questions
FNSINC612 Practice 3
Quiz
•
University
10 questions
Week 1: FOP
Quiz
•
University
16 questions
Healthy Choices
Quiz
•
KG - Professional Dev...
10 questions
LOST TRIVIA WEEK 4
Quiz
•
University
15 questions
COCU 7 - BREAKFAST PRODUCTION
Quiz
•
University
10 questions
Baking
Quiz
•
KG - Professional Dev...
13 questions
Stock Market W!SE Review 2
Quiz
•
KG - University
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
Discover more resources for Other
26 questions
Christmas Movie Trivia
Lesson
•
8th Grade - Professio...
20 questions
christmas songs
Quiz
•
KG - University
20 questions
Holiday Trivia
Quiz
•
9th Grade - University
15 questions
Holiday Movies
Quiz
•
University
14 questions
Christmas Trivia
Quiz
•
3rd Grade - University
20 questions
Christmas Trivia
Quiz
•
University
8 questions
5th, Unit 4, Lesson 8
Lesson
•
KG - Professional Dev...
20 questions
Disney Trivia
Quiz
•
University
