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 Interview Guide : 200+ Interview Questions and Answers - Java New Features - Java 5, 6, 7 and 8

Interactive video
•
University
8 questions
Java Interview Guide : 200+ Interview Questions and Answers - Synchronization of Threads: join, wait, notify and notifyA

Interactive video
•
University
6 questions
Java Programming for Complete Beginners - Java 16 - Step 16 - Understanding Data Structures - Tree - Sorted Order

Interactive video
•
University
8 questions
MongoDB Mastering MongoDB for Beginners (Theory and Projects) - Solution($elemMatch) Part 1

Interactive video
•
University
6 questions
Java Interview Guide : 200+ Interview Questions and Answers - What is an anonymous class?

Interactive video
•
University
6 questions
Java Interview Guide : 200+ Interview Questions and Answers - Course Overview

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

Interactive video
•
University
8 questions
Learn Java Unit Testing with JUnit 5 in 20 Steps - Comparing Arrays - assertArrayEquals

Interactive video
•
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 Information Technology (IT)
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