wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

java.util – Collections Framework-9

Total questions: 147

Worksheet time: 49mins

Name
Class
Date
1.
Which of these standard collection classes implements a dynamic array?
a)
AbstractList
b)
LinkedList
c)
ArrayList
d)
AbstractSet
2.
Which of these class can generate an array which can increase and decrease in size automatically?
a)
ArrayList()
b)
DynamicList()
c)
LinkedList()
d)
MallocList()
3.
Which of these method can be used to increase the capacity of ArrayList object manually?
a)
Capacity()
b)
increaseCapacity()
c)
increasecapacity()
d)
ensureCapacity()
4.
Which of these method of ArrayList class is used to obtain present size of an object?
a)
size()
b)
length()
c)
index()
d)
capacity()
5.
Which of these methods can be used to obtain a static array from an ArrayList object?
a)
Array()
b)
covertArray()
c)
toArray()
d)
covertoArray()
6.
Which of these method is used to reduce the capacity of an ArrayList object?
a)
trim()
b)
trimSize()
c)
trimTosize()
d)
trimToSize()
7.

What will be the output of the following Java program? https://gyazo.com/33f13b49749f6661b34ad51e60ca84b0

a)

[A, B, C, D]

b)

[A, D, B, C]

c)

[A, D, C]

d)

[A, B, C]

8.

What will be the output of the following Java program?

https://gyazo.com/3cb2900c0b07825763f60c2bc10b0258

a)

0

b)

1

c)

2

d)

Any Garbage Value

9.

What will be the output of the following Java program?

https://gyazo.com/f523cd35b2806fb4fd9efca1fecf9520

a)

1

b)

2

c)

3

d)

4

10.

What will be the output of the following Java program?

https://gyazo.com/4ea3062c5f17dbe07cfa2b9a49d379de

a)

1

b)

2

c)

3

d)

4

11.
Map implements collection interface?
a)
True
b)
False
12.
Which of the below does not implement Map interface?
a)
HashMap
b)
Hashtable
c)
EnumMap
d)
Vector
13.
What is the premise of equality for IdentityHashMap?
a)
Reference equality
b)
Name equality
c)
Hashcode equality
d)
Length equality
14.
What happens if we put a key object in a HashMap which exists?
a)
The new object replaces the older object
b)
The new object is discarded
c)
The old object is removed from the map
d)
It throws an exception as the key already exists in the map
15.
While finding the correct location for saving key value pair, how many times the key is hashed?
a)
1
b)
2
c)
3
d)
unlimited till bucket is found
16.
Is hashmap an ordered collection.
a)
True
b)
False
17.
If two threads access the same hashmap at the same time, what would happen?
a)
ConcurrentModificationException
b)
NullPointerException
c)
ClassNotFoundException
d)
RuntimeException
18.
How to externally synchronize hashmap?
a)
HashMap.synchronize(HashMap a);
b)
HashMap a = new HashMap(); a.synchronize();
c)
Collections.synchronizedMap(new HashMap<String, String>());
d)
Collections.synchronize(new HashMap<String, String>());
19.

What will be the output of the following Java code snippet?

https://gyazo.com/536fd105502737a2e2f69b680f818239

a)

{1=null, 2=null, 3=null, 4=null, 5=null}

b)

{5=null}

c)

Exception is thrown

d)

{1=null, 5=null, 3=null, 2=null, 4=null}

20.
If large number of items are stored in hash bucket, what happens to the internal structure?
a)
The bucket will switch from LinkedList to BalancedTree
b)
The bucket will increase its size by a factor of load size defined
c)
The LinkedList will be replaced by another hashmap
d)
Any further addition throws Overflow exception
21.
How can we remove an object from ArrayList?
a)
a) remove() method
b)
b) using Iterator
c)
c) remove() method and using Iterator
d)
d) delete() method
22.
How to remove duplicates from List?
a)
HashSet<String> listToSet = new HashSet<String>(duplicateList);
b)
HashSet<String> listToSet = duplicateList.toSet();
c)
HashSet<String> listToSet = Collections.convertToSet(duplicateList);
d)
HashSet<String> listToSet = duplicateList.getSet();
23.
How to sort elements of ArrayList?
a)
Collection.sort(listObj);
b)
Collections.sort(listObj);
c)
listObj.sort();
d)
Sorter.sortAsc(listObj);
24.
When two threads access the same ArrayList object what is the outcome of the program?
a)
Both are able to access the object
b)
ConcurrentModificationException is thrown
c)
One thread is able to access the object and second thread gets Null Pointer exception
d)
One thread is able to access the object and second thread will wait till control is passed to the second one
25.
How is Arrays.asList() different than the standard way of initialising List?
a)
Both are same
b)
Arrays.asList() throws compilation error
c)
Arrays.asList() returns a fixed length list and doesn’t allow to add or remove elements
d)
We cannot access the list returned using Arrays.asList()
26.
What is the difference between length() and size() of ArrayList?
a)
length() and size() return the same value
b)
length() is not defined in ArrayList
c)
size() is not defined in ArrayList
d)
length() returns the capacity of ArrayList and size() returns the actual number of elements stored in the list
27.
Which class provides thread safe implementation of List?
a)
ArrayList
b)
CopyOnWriteArrayList
c)
HashList
d)
List
28.
Which of the below is not an implementation of List interface?
a)
RoleUnresolvedList
b)
Stack
c)
AttibuteList
d)
SessionList
29.
What is the worst case complexity of accessing an element in ArrayList?
a)
O(n)
b)
O(1)
c)
O(nlogn)
d)
O(2)
30.
When an array is passed to a method, will the content of the array undergo changes with the actions carried within the function?
a)
True
b)
False
31.
What is the default clone of HashSet?
a)
Deep clone
b)
Shallow clone
c)
Plain clone
d)
Hollow clone
32.
Do we have get(Object o) method in HashSet.
a)
True
b)
False
33.
What does Collections.emptySet() return?
a)
Immutable Set
b)
Mutable Set
c)
The type of Set depends on the parameter passed to the emptySet() method
d)
Null object
34.
What are the initial capacity and load factor of HashSet?
a)
10, 1.0
b)
32, 0.75
c)
16, 0.75
d)
32, 1.0
35.

What will be the output of the following Java code snippet?

https://gyazo.com/39dd0a67933e5fd1745d42a65d88a945

a)

Test - 10 Test - 10

b)

Test – 10

c)

c) Runtime Exception

d)

d) Compilation Failure

36.
Set has contains(Object o) method.
a)
True
b)
False
37.
What is the difference between TreeSet and SortedSet?
a)
TreeSet is more efficient than SortedSet
b)
SortedSet is more efficient than TreeSet
c)
TreeSet is an interface; SortedSet is a concrete class
d)
SortedSet is an interface; TreeSet is a concrete class
38.
What happens if two threads simultaneously modify TreeSet?
a)
ConcurrentModificationException is thrown
b)
Both threads can perform action successfully
c)
FailFastException is thrown
d)
IteratorModificationException is thrown
39.
What is the unique feature of LinkedHashSet?
a)
It is not a valid class
b)
It maintains the insertion order and guarantees uniqueness
c)
It provides a way to store key values with uniqueness
d)
The elements in the collection are linked to each other
40.
Which of these standard collection classes implements a linked list data structure?
a)
AbstractList
b)
b) LinkedList
c)
HashSet
d)
AbstractSet
41.
Which of these classes implements Set interface?
a)
ArrayList
b)
HashSet
c)
LinkedList
d)
DynamicList
42.
Which of these method is used to add an element to the start of a LinkedList object?
a)
add()
b)
first()
c)
AddFirst()
d)
addFirst()
43.
Which of these method of HashSet class is used to add elements to its object?
a)
add()
b)
Add()
c)
addFirst()
d)
insert()
44.
Which of these methods can be used to delete the last element in a LinkedList object?
a)
remove()
b)
delete()
c)
removeLast()
d)
deleteLast()
45.
Which of this method is used to change an element in a LinkedList Object?
a)
change()
b)
set()
c)
redo()
d)
add()
46.

What will be the output of the following Java code snippet?

https://gyazo.com/4ead0b3ffffa7759cdae47951e9c6696

a)

[A, B, C]

b)

[D, B, C]

c)

[A, B, C, D]

d)

[D, A, B, C]

47.

What will be the output of the following Java program?

https://gyazo.com/e4545307519d5b433f31c04c9516ae3a

a)

[A, B]

b)

[B, C]

c)

[A, B, C, D]

d)

[A, B, C]

48.

What will be the output of the following Java program?

https://gyazo.com/685e7e88fdc15a3a646c13ff55f35877

a)

ABC 3

b)

[A, B, C] 3

c)

ABC 2

d)

[A, B, C] 2

49.

What will be the output of the following Java program?

https://gyazo.com/4ecc9b13b7b575a486c0686fa3b29db5

a)

[1, 3, 5, 8, 9]

b)

[3, 4, 1, 8, 9]

c)

[9, 8, 4, 3, 1]

d)

[1, 3, 4, 8, 9]

50.
Which of these object stores association between keys and values?
a)
Hash table
b)
Map
c)
Array
d)
String
51.
Which of these classes provide implementation of map interface?
a)
ArrayList
b)
HashMap
c)
LinkedList
d)
DynamicList
52.
Which of these method is used to remove all keys/values pair from the invoking map?
a)
delete()
b)
remove()
c)
clear()
d)
removeAll()
53.
Which of these method Map class is used to obtain an element in the map having specified key?
a)
search()
b)
get()
c)
set()
d)
look()
54.
Which of these methods can be used to obtain set of all keys in a map?
a)
getAll()
b)
getKeys()
c)
keyall()
d)
keySet()
55.
Which of these method is used add an element and corresponding key to a map?
a)
put()
b)
set()
c)
redo()
d)
add()
56.

What will be the output of the following Java program? https://gyazo.com/63fc228a37a3bbfc92af0b0ccef450a9

a)

{A 1, B 1, C 1}

b)

{A, B, C}

c)

{A-1, B-1, C-1}

d)

{A=1, B=2, C=3}

57.

What will be the output of the following Java program?

https://gyazo.com/1194bd9463926f6145dbaddc8a59ff44

a)

a) [A, B, C]

b)

b) {A, B, C}

c)

c) {1, 2, 3}

d)

d) [1, 2, 3]

58.

What will be the output of the following Java program?

https://gyazo.com/6697b9beda0c1c5532fd76d85d11ad24

a)

1

b)

2

c)

3

d)

Null

59.

What will be the output of the following Java program?

https://gyazo.com/0723bb7f42729a9fbbd3c3e9d0e84708

a)

[A, B, C]

b)

[1, 2, 3]

c)

{A=1, B=2, C=3}

d)

[A=1, B=2, C=3]

60.
Which of these class object can be used to form a dynamic array?
a)
ArrayList
b)
Map
c)
Vector
d)
ArrayList & Vector
61.
Which of these are legacy classes?
a)
Stack
b)
Hashtable
c)
Vector
d)
All of the mentioned
62.
Which of these is the interface of legacy?
a)
Map
b)
Enumeration
c)
HashMap
d)
Hashtable
63.
What is the name of a data member of class Vector which is used to store a number of elements in the vector?
a)
length
b)
elements
c)
elementCount
d)
capacity
64.
Which of these methods is used to add elements in vector at specific location?
a)
add()
b)
set()
c)
AddElement()
d)
addElement()
65.

What will be the output of the following Java code?

https://gyazo.com/cf33adde9247f4767dcbe6d1e83da927

a)

0

b)

3

c)

2

d)

5

66.

What will be the output of the following Java code?

https://gyazo.com/bdd728892cefe8958e22fe4a5b77b7a6

a)

2

b)

3

c)

4

d)

6

67.

What will be the output of the following Java code?

https://gyazo.com/29d9e286f17e2839f04f29e7b9efc173

a)

[3, 2, 6]

b)

[3, 2, 8]

c)

[3, 2, 6, 8]

d)

[3, 2, 8, 6]

68.

What will be the output of the following Java code?

https://gyazo.com/8d22092b2a26c2282e678703c34d7878

a)

0

b)

1

c)

True

d)

False

69.

What will be the output of the following Java code?

https://gyazo.com/0f87cb4e93dc6b2425aac0989e0e3c8b

a)

[3, 5]

b)

[3, 2]

c)

[3, 2, 5]

d)

[3, 5, 2]

70.
Which of these class object uses the key to store value?
a)
Dictionary
b)
Map
c)
Hashtable
d)
All of the mentioned
71.
Which of these method is used to insert value and its key?
a)
put()
b)
set()
c)
insertElement()
d)
addElement()
72.
Which of these is the interface of legacy is implemented by Hashtable and Dictionary classes?
a)
Map
b)
Enumeration
c)
HashMap
d)
Hashtable
73.
Which of these is a class which uses String as a key to store the value in object?
a)
Array
b)
ArrayList
c)
Dictionary
d)
Properties
74.
Which of these methods is used to retrieve the elements in properties object at specific location?
a)
get()
b)
Elementat()
c)
ElementAt()
d)
getProperty()
75.

What will be the output of the following Java code? https://gyazo.com/d8c03968897dc79eeeb722f1986459df

a)

0

b)

1

c)

True

d)

False

76.

What will be the output of the following Java code?

https://gyazo.com/9d51aae84ac152799fb32098483001c5

a)

0

b)

1

c)

2

d)

3

77.

What will be the output of the following Java code? https://gyazo.com/83504454951d75c8473940339dc910d1

a)

{C=8, B=2}

b)

[C=8, B=2]

c)

{A=3, C=8, B=2}

d)

[A=3, C=8, B=2]

78.

What will be the output of the following Java code? https://gyazo.com/6ebd23b4096423bec0158d330bef6493

a)

{C=8, B=2}

b)

[C=8, B=2]

c)

{A=3, C=8, B=2}

d)

[A=3, C=8, B=2]

79.

What will be the output of the following Java code? https://gyazo.com/4ad241951990545e7cd63573662c2339

a)

{AB, BC, CD}

b)

[AB, BC, CD]

c)

[3, 2, 8]

d)

{3, 2, 8}

80.
Which of these class object has an architecture similar to that of array?
a)
Bitset
b)
Map
c)
Hashtable
d)
All of the mentioned
81.
Which of these method is used to make a bit zero specified by the index?
a)
put()
b)
set()
c)
remove()
d)
clear()
82.
Which of these method is used to calculate number of bits required to hold the BitSet object?
a)
size()
b)
length()
c)
indexes()
d)
numberofBits()
83.
Which of these is a method of class Date which is used to search whether object contains a date before the specified date?
a)
after()
b)
contains()
c)
before()
d)
compareTo()
84.
Which of these methods is used to retrieve elements in BitSet object at specific location?
a)
get()
b)
Elementat()
c)
ElementAt()
d)
getProperty()
85.

What will be the output of the following Java code? https://gyazo.com/7b8f36b3397e48c780d401b14f5534e9

a)

{0, 1, 3, 4}

b)

{0, 1, 2, 4}

c)

{0, 1, 2, 3, 4}

d)

{0, 0, 0, 3, 4}

86.

What will be the output of the following Java code? https://gyazo.com/a8e6352cc536e3e86c773082e88e745a

a)

4 64

b)

5 64

c)

5 128

d)

4 128

87.

What will be the output of the following Java code? https://gyazo.com/b1a05e5abf557ff8bce8b100b423cebe

a)

2

b)

3

c)

4

d)

5

88.

What will be the output of the following Java code? https://gyazo.com/72d10c06066e64615d82acfa9b212a33

a)

a) Prints Present Date

b)

Runtime Error

c)

c) Any Garbage Value

d)

d) Prints Present Time & Date

89.

What will be the output of the following Java code? https://gyazo.com/b9c0ddfad67c1398ebb1aab4e1248ed8

a)

{0, 1}

b)

{2, 4}

c)

{3, 4}

d)

{3, 4, 5}

90.
What is Remote method invocation (RMI)?
a)
RMI allows us to invoke a method of java object that executes on another machine
b)
RMI allows us to invoke a method of java object that executes on another Thread in multithreaded programming
c)
RMI allows us to invoke a method of java object that executes parallely in same machine
d)
None of the mentioned
91.
Which of these package is used for remote method invocation?
a)
java.applet
b)
java.rmi
c)
java.lang.rmi
d)
java.lang.reflect
92.
Which of these methods are member of Remote class?
a)
checkIP()
b)
addLocation()
c)
AddServer()
d)
None of the mentioned
93.
Which of these Exceptions is thrown by remote method?
a)
RemoteException
b)
InputOutputException
c)
RemoteAccessException
d)
RemoteInputOutputException
94.
Which of these class is used for creating a client for a server-client operations?
a)
serverClientjava
b)
Client.java
c)
AddClient.java
d)
ServerClient.java
95.
Which of these package is used for all the text related modifications?
a)
java.text
b)
java.awt
c)
java.lang.text
d)
java.text.modify
96.

What will be the output of the following Java code? https://gyazo.com/8d26609330124913a4f46ed4b13e8116

a)

Program prints all the constructors of ‘java.awt.Dimension’ package

b)

Program prints all the possible constructors of class ‘Class’

c)

Program prints “Exception”

d)

Runtime Error

97.

What will be the output of the following Java code? https://gyazo.com/6bcd91421fb1ce0eb954cc7dfa3ad6a6

a)

Program prints all the constructors of ‘java.awt.Dimension’ package

b)

Program prints all the methods of ‘java.awt.Dimension’ package

c)

Program prints all the data members of ‘java.awt.Dimension’ package

d)

program prints all the methods and data member of ‘java.awt.Dimension’ package

98.

What is the length of the application box made in the following Java program? https://gyazo.com/b09a90264c6181577496bd4681001c3d

a)

20

b)

Default value

c)

Compilation Error

d)

Runtime Error

99.

What will be the output of the following Java program? https://gyazo.com/9be8c0917036942cc50e4102d0731018

a)

Program prints all the constructors of ‘java.awt.Dimension’ package

b)

Program prints all the methods of ‘java.awt.Dimension’ package

c)

Program prints all the data members of ‘java.awt.Dimension’ package

d)

program prints all the methods and data member of ‘java.awt.Dimension’ package

100.
Which of these packages contain all the collection classes?
a)
java.lang
b)
java.util
c)
java.net
d)
java.awt
101.
Which of these classes is not part of Java’s collection framework?
a)
Maps
b)
Array
c)
Stack
d)
Queue
102.
Which of this interface is not a part of Java’s collection framework?
a)
List
b)
Set
c)
SortedMap
d)
SortedList
103.
Which of these methods deletes all the elements from invoking collection?
a)
clear()
b)
reset()
c)
delete()
d)
refresh()
104.
What is Collection in Java?
a)
A group of objects
b)
A group of classes
c)
A group of interfaces
d)
None of the mentioned
105.

What will be the output of the following Java program? https://gyazo.com/f7a1fec6c1f19ccefc6adff8ef84fdcc

a)

12885

b)

12845

c)

58881

d)

54881

106.

What will be the output of the following Java program? https://gyazo.com/9df5e6ed65fe9dd552ef65b6ef610133

a)

{0, 1, 3, 4}

b)

{0, 1, 2, 4}

c)

{0, 1, 2, 3, 4}

d)

{0, 0, 0, 3, 4}

107.
Which of these return type of hasNext() method of an iterator?
a)
Integer
b)
Double
c)
Boolean
d)
Collections Object
108.
Which of these methods is used to obtain an iterator to the start of collection?
a)
start()
b)
begin()
c)
iteratorSet()
d)
iterator()
109.
Which of these methods can be used to move to next element in a collection?
a)
next()
b)
move()
c)
shuffle()
d)
hasNext()
110.
Which of these iterators can be used only with List?
a)
Setiterator
b)
ListIterator
c)
Literator
d)
None of the mentioned
111.
Which of these is a method of ListIterator used to obtain index of previous element?
a)
previous()
b)
previousIndex()
c)
back()
d)
goBack()
112.
Which of these exceptions is thrown by remover() method?
a)
IOException
b)
SystemException
c)
ObjectNotFoundExeception
d)
IllegalStateException
113.

What will be the output of the following Java program? https://gyazo.com/ce35498896fa5c5bb6ea040a5002dcdb

a)

0

b)

1

c)

-1

d)

EMPTY

114.

What will be the output of the following Java program? https://gyazo.com/3afcc88b2f1b2a00cd191cbf76540e1c

a)

2 8 5 1

b)

1 5 8 2

c)

2

d)

2 1 8 5

115.

What will be the output of the following Java program? https://gyazo.com/9f996d335c49f0e5493cf34ecbddb37b

a)

2 8 5 1

b)

1 5 8 2

c)

1 2 5 8

d)

2 1 8 5

116.

What will be the output of the following Java program? https://gyazo.com/d31fb342ff0ef2325814f6cea65ecc7c

a)

2 8 5

b)

2 1 8

c)

2 5 8

d)

8 5 1

117.
Which of the below is not a subinterface of Queue?
a)
BlockingQueue
b)
BlockingEnque
c)
TransferQueue
d)
BlockingQueue
118.
What is the remaining capacity of BlockingQueue whose intrinsic capacity is not defined?
a)
Integer.MAX_VALUE
b)
BigDecimal.MAX_VALUE
c)
99999999
d)
Integer.INFINITY
119.
PriorityQueue is thread safe.
a)
True
b)
False
120.
What is difference between dequeue() and peek() function of java?
a)
dequeue() and peek() remove and return the next time in line
b)
dequeue() and peek() return the next item in line
c)
dequeue() removes and returns the next item in line while peek() returns the next item in line
d)
peek() removes and returns the next item in line while dequeue() returns the next item in line
121.
What is the difference between Queue and Stack?
a)
Stack is LIFO; Queue is FIFO
b)
Queue is LIFO; Stack is FIFO
c)
Stack and Queue is FIFO
d)
Stack and Queue is LIFO
122.
What are the use of front and rear pointers in CircularQueue implementation?
a)
Front pointer points to first element; rear pointer points to the last element
b)
Rear pointer points to first element; front pointer points to the last element
c)
Front and read pointers point to the first element
d)
Front pointer points to the first element; rear pointer points to null object
123.
What is the correct method used to insert and delete items from the queue?
a)
push and pop
b)
enqueue and dequeue
c)
enqueue and peek
d)
add and remove
124.
Which data structure is used in Breadth First Traversal of a graph?
a)
Stack
b)
Queue
c)
Array
d)
Tree
125.
Where does a new element be inserted in linked list implementation of a queue?
a)
Head of list
b)
Tail of list
c)
At the centre of list
d)
All the old entries are pushed and then the new element is inserted
126.
If the size of the array used to implement a circular queue is MAX_SIZE. How rear moves to traverse inorder to insert an element in the queue?
a)
rear=(rear%1)+MAX_SIZE
b)
rear=(rear+1)%MAX_SIZE
c)
rear=rear+(1%MAX_SIZE)
d)
rear=rear%(MAX_SIZE+1)
127.
Which of these standard collection classes implements all the standard functions on list data structure?
a)
Array
b)
LinkedList
c)
HashSet
d)
AbstractSet
128.
Which of this method is used to make all elements of an equal to specified value?
a)
add()
b)
fill()
c)
all()
d)
set()
129.
Which of these methods can be used to search an element in a list?
a)
find()
b)
sort()
c)
get()
d)
binaryserach()
130.

What will be the output of the following Java program? https://gyazo.com/ac98d75bb258b45c0e407b3a32703d64

a)

0

b)

1

c)

True

d)

False

131.

What will be the output of the following Java program? https://gyazo.com/a6389a6b82510253524a2925754d37e8

a)

12345

b)

54321

c)

1234

d)

5432

132.

What will be the output of the following Java program? https://gyazo.com/2f9cab99d29f6bca39285457a2659b2e

a)

2

b)

3

c)

4

d)

5

133.
Which of these interface declares core method that all collections will have?
a)
set
b)
EventListner
c)
Comparator
d)
Collection
134.
Which of these interface handle sequences?
a)
Set
b)
List
c)
Comparator
d)
Collection
135.
Which of this interface must contain a unique element?
a)
Set
b)
List
c)
Array
d)
Collection
136.
Which of these is a Basic interface that all other interface inherits?
a)
Set
b)
Array
c)
List
d)
Collection
137.
Which of these is static variable defined in Collections?
a)
EMPTY_SET
b)
EMPTY_LIST
c)
EMPTY_MAP
d)
All of the mentioned
138.

What will be the output of the following Java program? https://gyazo.com/576eea852f266c02cd5021dd10a1ff79

a)

12345

b)

54321

c)

1234

d)

5432

139.

What will be the output of the following Java program? https://gyazo.com/29f74df2f82a35795807d7a59867424e

a)

2 8 5 1

b)

1 5 8 2

c)

1 2 5 8

d)

2 1 8 5

140.

What will be the output of the following Java program? https://gyazo.com/8afedde1e51abd3217a9b8f07d0ebdc3

a)

2 8 5 1

b)

1 5 8 2

c)

1 2 5 8

d)

Any random order

141.
Which of these is an incorrect form of using method max() to obtain a maximum element?
a)
max(Collection c)
b)
max(Collection c, Comparator comp)
c)
max(Comparator comp)
d)
max(List c)
142.
Which of these methods sets every element of a List to a specified object?
a)
set()
b)
fill()
c)
Complete()
d)
add()
143.
Which of these methods can randomize all elements in a list?
a)
rand()
b)
randomize()
c)
shuffle()
d)
ambiguous()
144.
Which of these methods can convert an object into a List?
a)
SetList()
b)
ConvertList()
c)
singletonList()
d)
CopyList()
145.
Which of these is true about unmodifiableCollection() method?
a)
unmodifiableCollection() returns a collection that cannot be modified
b)
unmodifiableCollection() method is available only for List and Set
c)
unmodifiableCollection() is defined in Collection class
d)
none of the mentioned
146.

What will be the output of the following Java program? https://gyazo.com/a86ecadecbc4ab1d0753c0cbc2ad08c5

a)

2 8 5 1

b)

1 5 8 2

c)

2

d)

2 1 8 5

147.

What will be the output of the following Java program? https://gyazo.com/109b4f80227f50c8671e063e954107eb

a)

2 8 5 1

b)

1 5 8 2

c)

2

d)

2 1 8 5