Java Collections Quiz

Java Collections Quiz

University

11 Qs

quiz-placeholder

Similar activities

TOPIC 1 - INTRODUCTION TO BUSINESS ETHICS

TOPIC 1 - INTRODUCTION TO BUSINESS ETHICS

University

10 Qs

FNSINC612 Practice 3

FNSINC612 Practice 3

University

15 Qs

EC8552_ CAO_MODEL IV_PART B _ 09-12-2020

EC8552_ CAO_MODEL IV_PART B _ 09-12-2020

University

15 Qs

Week 1: FOP

Week 1: FOP

University

10 Qs

Would you rather keeper of the lost cities

Would you rather keeper of the lost cities

KG - Professional Development

10 Qs

GE 8 (Ethics) - Module 1

GE 8 (Ethics) - Module 1

University

10 Qs

PASS W9 - Cross cultural psychology

PASS W9 - Cross cultural psychology

University

11 Qs

Baking

Baking

KG - Professional Development

10 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?