Java Interview Guide : 200+ Interview Questions and Answers - Collection Code Examples
Interactive Video
•
Information Technology (IT), Architecture, Physical Ed
•
University
•
Practice Problem
•
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.
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
8 questions
Complete Python Scripting for Automation - Simple practice with for loop
Interactive video
•
University
8 questions
Selenium WebDriver with Java - Basics to Advanced and Frameworks - Examples of Array List
Interactive video
•
University
8 questions
JavaScript Masterclass - Zero to Job-Ready with Hands-On Projects - Promises All / 186
Interactive video
•
University
8 questions
Implementing Bubble Sort
Interactive video
•
University
8 questions
Next.js from Development to Deployment - Fetch Paginated Posts
Interactive video
•
University
8 questions
Linux Crash Course for Beginners - 2023 - Creating Files and Directories
Interactive video
•
University
8 questions
Use pivot_longer() to shape and manipulate your data - R programming for beginners
Interactive video
•
University
8 questions
Linux Crash Course for Beginners - 2023 - File Display Commands
Interactive video
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Information Technology (IT)
12 questions
IREAD Week 4 - Review
Quiz
•
3rd Grade - University
23 questions
Subject Verb Agreement
Quiz
•
9th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
7 questions
Renewable and Nonrenewable Resources
Interactive video
•
4th Grade - University
5 questions
Poetry Interpretation
Interactive video
•
4th Grade - University
19 questions
Black History Month Trivia
Quiz
•
6th Grade - Professio...
15 questions
Review1
Quiz
•
University
15 questions
Pre1
Quiz
•
University