java Collection Framework

java Collection Framework

University

19 Qs

quiz-placeholder

Similar activities

Java Quiz 2

Java Quiz 2

University

15 Qs

Data Structures Quiz

Data Structures Quiz

University

20 Qs

Team 4 Data structure

Team 4 Data structure

University

20 Qs

NSCC-CODE TO COIN

NSCC-CODE TO COIN

University

15 Qs

Data Structures

Data Structures

10th Grade - University

18 Qs

Repaso de Java Collections y Maven

Repaso de Java Collections y Maven

University

20 Qs

ARRAYLIST - JAVA

ARRAYLIST - JAVA

University

15 Qs

Data Structures and Algorithm

Data Structures and Algorithm

University

20 Qs

java Collection Framework

java Collection Framework

Assessment

Quiz

Computers

University

Hard

Created by

Prof Yetty

Used 1+ times

FREE Resource

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.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?