Java I/O streams, Files and collection frameworks

Java I/O streams, Files and collection frameworks

University

22 Qs

quiz-placeholder

Similar activities

QUIZ  "WORKSHOP 2024"

QUIZ "WORKSHOP 2024"

University

20 Qs

Day 9 - ONLINE TEST - PL03 PYTHON PROGRAMMING

Day 9 - ONLINE TEST - PL03 PYTHON PROGRAMMING

University

20 Qs

Java Quiz

Java Quiz

University

25 Qs

IF Pagi - Quiz 2

IF Pagi - Quiz 2

University

20 Qs

OOP - session 2.1 - JVM, Array, Stack

OOP - session 2.1 - JVM, Array, Stack

University

21 Qs

mobile application development no 2

mobile application development no 2

University

24 Qs

JAVA FOR ANDROID-ANDROID

JAVA FOR ANDROID-ANDROID

University

20 Qs

Templates,Exceptions,Inheritance in C++ Quiz

Templates,Exceptions,Inheritance in C++ Quiz

University

20 Qs

Java I/O streams, Files and collection frameworks

Java I/O streams, Files and collection frameworks

Assessment

Quiz

Computers

University

Hard

Created by

Benila S

FREE Resource

22 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following declarations don't compile?

A)List<?> l1 = new ArrayList<>();

B)List<String> l2 = new ArrayList();

C) List<? super Object> l3 = new ArrayList<String>();

D) List<? extends Object> l4 = new ArrayList<String>();

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

public class Question {

public static void main(String[] args) {

Question q = new Question();

List<Integer> l = new ArrayList<>();

l.add(20); l.add(30); q.m1(l); }

private void m1(List<?> l) { m2(l); // 1 }

private <T> void m2(List<T> l)

{ l.set(1, l.get(0)); // 2

System.out.println(l);

}

}

A) [20, 20]

B) Compilation fails on the line marked as // 1

C) Compilation fails on the line marked as // 2

D) An exception occurs at runtime

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

public class Question <T extends Number> {

T t;

public static void main(String[] args) {

Question q = new Question<Integer>(); // 1

q.t = new Float(1); // 2

System.out.println(q.t);

}

}

A. 1.0

B. Compilation fails on the line marked as // 1

C. Compilation fails on the line marked as // 2

D. An exception occurs at runtime

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

import java.util.*;

class UtilitiesTest {

public static void main(String[] args) {

List < int > intList = new ArrayList < > ();

intList.add(10);

intList.add(20);

System.out.println("The list is: " + intList);

A) It prints the following: The list is: [10, 20] 

B) It prints the following: The list is: [20, 10] 

C. It results in a compiler error 

D. It results in a runtime exception

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which interface represents a resizable array of objects in Java Collections?

a) Set

b) List

c) Map

d) Queue

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these is not a method defined in the Map interface?

a) put()

b) get()

c) remove()

d) add()

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of these interfaces is not part of the Java Collections Framework?

d) Sortable

a) List

b) SortedMap

c) SortedSet

d) Sortable

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?