Quiz Week 3

Quiz Week 3

Vocational training

10 Qs

quiz-placeholder

Similar activities

Python_Quiz_1

Python_Quiz_1

University

10 Qs

OSS Contribution

OSS Contribution

Professional Development

10 Qs

Getting Familiar with GIT and GITHUB

Getting Familiar with GIT and GITHUB

University

15 Qs

Express Course (v2024) Quiz 3

Express Course (v2024) Quiz 3

6th - 8th Grade

10 Qs

Keamanan Berbagi File

Keamanan Berbagi File

10th Grade - University

10 Qs

Se liga 3º trimestre 1º ano

Se liga 3º trimestre 1º ano

10th Grade

15 Qs

Quiz aula 8

Quiz aula 8

9th - 12th Grade

10 Qs

AC PORTAS

AC PORTAS

Professional Development

10 Qs

Quiz Week 3

Quiz Week 3

Assessment

Quiz

Information Technology (IT)

Vocational training

Practice Problem

Medium

Created by

Hans Parmar

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?