Home / CSE MCQs / JAVA MCQs :: Collections - Java

CSE MCQs :: JAVA MCQs

  1. Which of these is an incorrect form of using method max() to obtain maximum element?
  2. A.
    max(Collection c)
    B.
    max(Collection c, Comparator comp)
    C.
    max(Comparator comp)
    D.
    max(List c)

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. Which of these methods sets every element of a List to a specified object?
  4. A.
    set()
    B.
    fill()
    C.
    Complete()
    D.
    add()

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. Which of these methods can randomize all elements in a list?
  6. A.
    rand()
    B.
    randomize()
    C.
    shuffle()
    D.
    ambigous()

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. Which of these methods can convert an object into a List?
  8. A.
    SetList()
    B.
    ConvertList()
    C.
    singletonList()
    D.
    CopyList()

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. Which of these is true about unmodifiableCollection() method?
  10. 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.

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. Which of these is static variable defined in Collections?
  12. A.
    EMPTY_SET
    B.
    EMPTY_LIST
    C.
    EMPTY_MAP
    D.
    All of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum