in Education by
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) This question was addressed to me during an interview. This question is from Collection Algorithms in division java.util – The Collections Framework of Java Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
The correct choice is (c) max(Comparator comp) To explain: Its illegal to call max() only with comparator, we need to give the collection to be searched into.

Related questions

0 votes
    Which of these method Map class is used to obtain an element in the map having specified key? (a) ... Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these is a method of ListIterator used to obtain index of previous element? (a) previous() (b ... Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these method is used to add an element to the start of a LinkedList object? (a) add() (b ... The Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these method of Locale class can be used to obtain country of operation? (a) getCountry() (b) ... Utility Classes of Java Select the correct answer from above options...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    Which of these methods is used to obtain an iterator to the start of collection? (a) start() (b) ... Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of this method is used to change an element in a LinkedList Object? (a) change() (b) set() ... The Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these methods can be used to obtain set of all keys in a map? (a) getAll() (b) getKeys( ... The Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these methods can be used to delete the last element in a LinkedList object? (a) remove() (b ... Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these methods can be used to move to next element in a collection? (a) next() (b) move() ... The Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these methods sets every element of a List to a specified object? (a) set() (b) fill() ( ... The Collections Framework of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these class object can be used to form a dynamic array? (a) ArrayList (b) Map (c) Vector ... Collections 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
    Which of these method of Array class is used sort an array or its subset? (a) binarysort() (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 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
...