Collections

Collections

University

10 Qs

quiz-placeholder

Similar activities

Kelas 7 - Halaman 12 (UH Bab 1)

Kelas 7 - Halaman 12 (UH Bab 1)

7th Grade - University

15 Qs

PDM LS01 - Quiz 5 - Files and Menu Driven Programming

PDM LS01 - Quiz 5 - Files and Menu Driven Programming

University

15 Qs

Arquitectura IA-32 e IA-64

Arquitectura IA-32 e IA-64

University

10 Qs

Session 08: Array

Session 08: Array

University

15 Qs

Materi Berpikir Komputasional

Materi Berpikir Komputasional

9th Grade - University

10 Qs

Quiz Meet 2 Mini SC Programing

Quiz Meet 2 Mini SC Programing

University

10 Qs

Fundamentos de Bases de Datos

Fundamentos de Bases de Datos

10th Grade - University

15 Qs

Quiz Array

Quiz Array

10th Grade - University

10 Qs

Collections

Collections

Assessment

Quiz

Information Technology (IT)

University

Practice Problem

Medium

Created by

Yosuva Sirumani

Used 3+ 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 • 20 pts

1. Which interface is the root interface in the Java Collection hierarchy?

A. Collection

B. Map

C. Iterable

D. List

2.

MULTIPLE CHOICE QUESTION

30 sec • 20 pts

2. What is the main difference between ArrayList and LinkedList?

A. ArrayList is thread-safe, LinkedList is not

B. LinkedList allows duplicate elements, ArrayList doesn't

C. ArrayList uses a dynamic array, LinkedList uses nodes

D. LinkedList is faster for indexing

3.

MULTIPLE CHOICE QUESTION

30 sec • 20 pts

3. Which of these classes implements the Set interface?

A. HashMap

B. ArrayList

C. HashSet

D. TreeMap

4.

MULTIPLE CHOICE QUESTION

30 sec • 20 pts

4. Which method is used to remove all elements from a Collection?

A. clear()

B. deleteAll()

C. removeAll()

D. erase()

5.

MULTIPLE CHOICE QUESTION

30 sec • 20 pts

5. What will the following code output?
Set<String> set = new HashSet<>();

set.add("Apple");

set.add("Banana");

set.add("Apple");

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

A. 1

B. 2

C. 3

D. Compilation Error

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

6. Which class guarantees that the order of elements will remain the same as inserted?

A. HashSet

B. TreeSet

C. LinkedHashSet

D. PriorityQueue

7.

MULTIPLE CHOICE QUESTION

30 sec • 20 pts

7. What is the output of this code snippet?
Map<String, Integer> map = new HashMap<>();

map.put("A", 100);

map.put("B", 200);

map.put("A", 300);
System.out.println(map.get("A"));

A. 100

B. 200

C. 300

D. Null

Create a free account and access millions of resources

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?