Sail E0 Webinar

MCQs

Total Questions : 16 | Page 2 of 2 pages
Question 11. Which of these is an incorrect form of using method max() to obtain maximum element?
  1.    max(Collection c)
  2.    max(Collection c, Comparator comp)
  3.    max(Comparator comp)
  4.    max(List c)
 Discuss Question
Answer: Option C. -> max(Comparator comp)


Its illegal to call max() only with comparator, we need to give the collection to be serched into.


Question 12. Which of these methods sets every element of a List to a specified object?
  1.    set()
  2.    fill()
  3.    Complete()
  4.    add()
 Discuss Question
Answer: Option B. -> fill()


fill()


Question 13. Which of these methods can convert an object into a List?
  1.    SetList()
  2.    ConvertList()
  3.    singletonList()
  4.    CopyList()
 Discuss Question
Answer: Option C. -> singletonList()


singletonList() returns the object as an immutable List. This is a easy way to convert a single object into a list. This was added by Java 2.0.


Question 14. Which of these is true about unmodifiableCollection() method?
  1.    unmodifiableCollection() returns a collection that cannot be modified.
  2.    unmodifiableCollection() method is available only for List and Set.
  3.    unmodifiableCollection() is defined in Collection class.
  4.    None of the mentioned.
 Discuss Question
Answer: Option B. -> unmodifiableCollection() method is available only for List and Set.


unmodifiableCollection() is available for al collections, Set, Map, List etc.


Question 15. Which of these methods can randomize all elements in a list?
  1.    rand()
  2.    randomize()
  3.    shuffle()
  4.    ambigous()
 Discuss Question
Answer: Option C. -> shuffle()


shuffle “ randomizes all the elements in a list.


Question 16. Which of these is static variable defined in Collections?
  1.    EMPTY_SET
  2.    EMPTY_LIST
  3.    EMPTY_MAP
  4.    All of the mentioned
 Discuss Question
Answer: Option D. -> All of the mentioned


All of the mentioned


Latest Videos

Latest Test Papers