in Education by
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 The question was asked in class test. My question is from Data Structures-Set in portion java.util – The Collections Framework of Java Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
Correct option is (a) Immutable Set To explain I would say: Immutable Set is useful in multithreaded environment. One does not need to declare generic type collection. It is inferred by the context of method call.

Related questions

0 votes
    Which of these interface declares core method that all collections will have? (a) set (b) EventListner (c) ... Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these return type of hasNext() method of an iterator? (a) Integer (b) Double (c) Boolean (d ... Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    What is the return type of Math.random() method? (a) Integer (b) Double (c) String (d) Boolean This ... More Utility Classes of Java Select the correct answer from above options...
asked Feb 24, 2022 in Education by JackTerrance
0 votes
    What does Collections.emptySet() return? (a) Immutable Set (b) Mutable Set (c) The type of Set ... programming questions and answers pdf, java interview questions for beginners...
asked Oct 25, 2021 in Education by JackTerrance
0 votes
    Where does a new element be inserted in linked list implementation of a queue? (a) Head of list (b) ... Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    When two threads access the same ArrayList object what is the outcome of the program? (a) Both are able ... Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    How is Arrays.asList() different than the standard way of initialising List? (a) Both are same (b) ... Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    What is the difference between length() and size() of ArrayList? (a) length() and size() return the ... Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which class provides thread safe implementation of List? (a) ArrayList (b) CopyOnWriteArrayList (c) HashList (d) ... Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of the below is not an implementation of List interface? (a) RoleUnresolvedList (b) Stack (c) AttibuteList ... Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    What is the worst case complexity of accessing an element in ArrayList? (a) O(n) (b) O(1) (c) O( ... The Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    What is the default clone of HashSet? (a) Deep clone (b) Shallow clone (c) Plain clone (d) Hollow ... Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Do we have get(Object o) method in HashSet. (a) True (b) False The question was posed to me by my ... The Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    What are the initial capacity and load factor of HashSet? (a) 10, 1.0 (b) 32, 0.75 (c) 16, 0. ... - The Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Set has contains(Object o) method. (a) True (b) False The question was posed to me by my school ... Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
...