java Collection Framework

java Collection Framework

University

19 Qs

quiz-placeholder

Similar activities

Mikropemproses dan Mikropengawal

Mikropemproses dan Mikropengawal

12th Grade - University

15 Qs

PSP Module-4

PSP Module-4

University

20 Qs

DSA5541 Quiz 1 TRI 2210

DSA5541 Quiz 1 TRI 2210

University

20 Qs

Review Quiz (Chapter 3&4)

Review Quiz (Chapter 3&4)

University

20 Qs

HTML Quiz

HTML Quiz

11th Grade - University

15 Qs

Information System and Modern Organization part 1

Information System and Modern Organization part 1

University

14 Qs

Computer Science Quiz

Computer Science Quiz

University

15 Qs

VB

VB

University

20 Qs

java Collection Framework

java Collection Framework

Assessment

Quiz

Computers

University

Practice Problem

Hard

Created by

Prof Yetty

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...

19 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which method would you use to retrieve an element at a specific index in an ArrayList?

get()
indexOf()
find()
search()

Answer explanation

get() retrieves an element at the specified index in an ArrayList.

2.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What happens when you add an element to an ArrayList at an index greater than its size?

Throws an IndexOutOfBoundsException
Resizes automatically
Pads with null values
Replaces the last element

Answer explanation

Adding at an invalid index throws an IndexOutOfBoundsException.

3.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which of the following operations are NOT supported by a Set?

Adding duplicate elements
Removing elements
Iterating through elements
Checking the size

Answer explanation

A Set does not allow adding duplicate elements.

4.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

True or False: A TreeSet maintains the insertion order of elements.

True
False
N/A
N/A

Answer explanation

A TreeSet orders elements naturally or via a comparator, not by insertion order.

5.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which method adds an element to the end of a Queue?

add()
offer()
enqueue()
insert()

Answer explanation

offer() is used to add an element to the end of a Queue.

6.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

Which collection allows adding and removing elements from both ends efficiently?

LinkedList
PriorityQueue
ArrayList
Deque

Answer explanation

Deque allows adding and removing elements from both ends efficiently.

7.

MULTIPLE CHOICE QUESTION

10 sec • 1 pt

What will happen if you try to retrieve an element from an empty PriorityQueue using remove()?

Returns null
Throws NoSuchElementException
Throws IllegalStateException
Adds a default element

Answer explanation

remove() throws NoSuchElementException if the queue is empty.

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?

Discover more resources for Computers