Java Collections Quiz

Java Collections Quiz

University

11 Qs

quiz-placeholder

Similar activities

The year 2021

The year 2021

7th Grade - University

11 Qs

QUIZ 2 LAND DEALINGS

QUIZ 2 LAND DEALINGS

University

10 Qs

QUIZ IN HEALTH Q4

QUIZ IN HEALTH Q4

10th Grade - University

15 Qs

CS8391 Data Structure U.II

CS8391 Data Structure U.II

University

15 Qs

Review of Seminar 7 and 8 materials

Review of Seminar 7 and 8 materials

University

12 Qs

Session 3

Session 3

University

13 Qs

Practice Game

Practice Game

University

10 Qs

Youtubers And Games Quiz

Youtubers And Games Quiz

1st Grade - Professional Development

16 Qs

Java Collections Quiz

Java Collections Quiz

Assessment

Quiz

Other

University

Practice Problem

Hard

Created by

Niveditha N

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

11 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which Java collection class is most suitable to represent a shopping cart where items can be accessed by index and duplicates are allowed?

HashSet

HashMap

ArrayList

TreeSet

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In a school attendance system where each student should be marked present only once, which collection would you use?

ArrayList

HashSet

TreeMap

Stack

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

You are building a dictionary application where each word maps to its meaning. Which collection is best suited?

LinkedList

Stack

HashMap

TreeSet

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which collection would you use to store a list of students in the order of registration, without allowing duplicates?

TreeMap

LinkedHashSet

PriorityQueue

Hashtable

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output of the following?

List list = new ArrayList<>();

list.add("A"); list.add("B"); list.add("A");

Set set = new HashSet<>(list);

System.out.println(set.size());

2

3

Compilation Error

Runtime Exception

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result of this code? List list = new ArrayList<>(); list.add("A"); list.add("B"); list.add(1, "C"); System.out.println(list);

[A, B, C]

[A, C, B]

[C, A, B]

Compilation Error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider this code: List list = Arrays.asList(1, 2, 3, 4, 5); list.set(2, 10); System.out.println(list);

[1, 2, 10, 4, 5]

[1, 10, 3, 4, 5]

Compilation Error

Runtime Exception

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?