Java Collections Quiz

Java Collections Quiz

University

47 Qs

quiz-placeholder

Similar activities

112 Review

112 Review

University

45 Qs

Introducción a la programación

Introducción a la programación

University

48 Qs

Java-Lab-Viva-Quiz-Batch11

Java-Lab-Viva-Quiz-Batch11

University

51 Qs

Java Programming Quiz

Java Programming Quiz

University

45 Qs

C# and DotNet Framework

C# and DotNet Framework

University

50 Qs

Data Structures Quiz

Data Structures Quiz

University

44 Qs

PF201: SCCPF2012223

PF201: SCCPF2012223

University

50 Qs

SAS Informatika Ganjil Kelas 8

SAS Informatika Ganjil Kelas 8

8th Grade - 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?