Java Collections Quiz

Java Collections Quiz

University

47 Qs

quiz-placeholder

Similar activities

Quiz

Quiz

University

50 Qs

2EB Quiz 04 Dec 2024

2EB Quiz 04 Dec 2024

University

50 Qs

CS8391 - Data Structure  - IAT I

CS8391 - Data Structure - IAT I

University

50 Qs

Data Structures and Algorithm - Final Examinations Quiz

Data Structures and Algorithm - Final Examinations Quiz

University

51 Qs

File Organization

File Organization

University

45 Qs

LATIHAN SOAL

LATIHAN SOAL

10th Grade - University

50 Qs

Algoritma dan Struktur Data

Algoritma dan Struktur Data

University

50 Qs

SKILL QUIZ

SKILL QUIZ

University

50 Qs

Java Collections Quiz

Java Collections Quiz

Assessment

Quiz

Computers

University

Hard

Created by

Mr. Mourya

Used 1+ times

FREE Resource

47 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the output? List list = new ArrayList<>(); list.add("Java"); list.add("Python"); list.remove("Java"); System.out.println(list);

[Java]

[Python]

[Java, Python]

[]

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output? Set set = new TreeSet<>(); set.add(3); set.add(1); set.add(2); System.out.println(set);

[3, 2, 1]

[1, 2, 3]

[1, 3, 2]

[2, 1, 3]

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be printed? List list = Arrays.asList(1, 2, 3); list.set(1, 5); System.out.println(list);

[1, 2, 3]

[1, 5, 3]

[5, 1, 3]

Compilation error

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will be the result? Queue q = new PriorityQueue<>(); q.add(10); q.add(5); q.add(1); System.out.println(q.peek());

10

5

1

0

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Output? Deque dq = new LinkedList<>(); dq.addFirst("A"); dq.addLast("B"); System.out.println(dq);

[B, A]

[A, B]

[A]

[B]

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does this code output? Stack stack = new Stack<>(); stack.push("X"); stack.push("Y"); stack.pop(); System.out.println(stack.peek());

X

Y

null

Compilation error

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the result? List list = new LinkedList<>(); 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

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?