Java Interview Guide : 200+ Interview Questions and Answers - Collection Code Examples

Interactive Video
•
Information Technology (IT), Architecture, Physical Ed
•
University
•
Hard
Wayground Content
FREE Resource
Read more
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens when you add an element to an ArrayList without specifying an index?
The element is not added.
The element is added at the beginning of the list.
The element is added at the end of the list.
The element replaces the first element.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method would you use to check if an ArrayList contains a specific element?
indexOf
contains
get
add
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What must a class implement to be sorted using Collections.sort()?
Serializable
Comparator
Iterable
Comparable
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you sort a collection in descending order?
Use Collections.reverseOrder()
Use a custom Comparator
Use Collections.sort() with a flag
Use a custom Comparable
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a key characteristic of a HashSet?
It maintains elements in insertion order.
It does not allow duplicate elements.
It sorts elements in natural order.
It allows duplicate elements.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In a TreeSet, how are elements stored?
In insertion order
In reverse order
In random order
In sorted order
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens when you add a duplicate key to a HashMap?
The new value replaces the old value.
The key is ignored.
An error is thrown.
Both values are stored.
Create a free account and access millions of resources
Similar Resources on Wayground
8 questions
Java Programming for Complete Beginners - Java 16 - Step 12 - List and ArrayList - Sorting - Providing Flexibility by Im

Interactive video
•
University
6 questions
Complete Java SE 8 Developer Bootcamp - Comparator

Interactive video
•
University
8 questions
Java Interview Guide : 200+ Interview Questions and Answers - Collections & List Interface methods and classes - ArrayLi

Interactive video
•
University
8 questions
Java Programming for Complete Beginners - Java 16 - Java Tip 13 - Anonymous Classes

Interactive video
•
University
8 questions
Java Interview Guide : 200+ Interview Questions and Answers - Concurrent Collections – CopyOnWriteArrayList

Interactive video
•
University
6 questions
Complete Java SE 8 Developer Bootcamp - Sorting and Searching Collections

Interactive video
•
University
8 questions
Java Interview Guide : 200+ Interview Questions and Answers - Set interfaces and implementations - HashSet, LinkedHashSe

Interactive video
•
University
6 questions
Java Programming for Complete Beginners - Java 16 - Step 28 - Java Collections - Conclusion with Three Tips

Interactive video
•
University
Popular Resources on Wayground
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World

Quiz
•
3rd - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
20 questions
ELA Advisory Review

Quiz
•
7th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns

Quiz
•
3rd Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Information Technology (IT)
11 questions
NFL Football logos

Quiz
•
KG - Professional Dev...
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

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

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
38 questions
Unit 6 Key Terms

Quiz
•
11th Grade - University
20 questions
La Hora

Quiz
•
9th Grade - University
7 questions
Cell Transport

Interactive video
•
11th Grade - University
7 questions
What Is Narrative Writing?

Interactive video
•
4th Grade - University