Quiz Week 3
Quiz
•
Information Technology (IT)
•
Vocational training
•
Practice Problem
•
Medium
Hans Parmar
Used 1+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the primary difference between an ArrayList and a HashSet in Java?
ArrayList is ordered, HashSet is unordered.
ArrayList allows duplicates, HashSet does not.
ArrayList is faster for searching, HashSet is faster for insertion.
All of the above.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which Java Collection would you use to store a list of unique student IDs?
ArrayList
LinkedList
HashSet
HashMap
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you insert an element at a specific index in an ArrayList?
list.add(index, element)
list.insert(index, element)
list.put(index, element)
list.set(index, element)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the time complexity of accessing an element at a given index in an ArrayList?
O(1)
O(log n)
O(n)
O(n^2)
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How does HashSet ensure uniqueness of elements?
By using a linked list internally.
By using a hash function to map elements to buckets.
By sorting the elements.
By comparing elements using the equals() method.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the time complexity of searching for an element in a HashSet?
a) O(1) on average
O(log n)
O(n)
O(n^2)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Describe a scenario where an ArrayList would be a more suitable choice than a HashSet.
Storing a list of unique usernames.
Storing a list of students in the order they enrolled.
Storing a list of distinct prime numbers.
Storing a list of unique email addresses.
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
EVALUASI STRUKTUR DATA
Quiz
•
10th Grade
15 questions
Análise do Código React Native
Quiz
•
Professional Development
14 questions
Latihan 2
Quiz
•
12th Grade
15 questions
Soal HTML
Quiz
•
10th Grade
12 questions
Konteynerlar (C++)
Quiz
•
University
11 questions
Структурированный тип данных массив
Quiz
•
10th Grade - University
15 questions
Lista de Exercícios – Vetores em Java - Parte I
Quiz
•
University
15 questions
The Linux Vault
Quiz
•
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
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th 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
