Data Structures


  1. What is the default clone of HashSet?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Default clone() method uses shallow copy. The internal elements are not cloned. A shallow copy only copies the reference object.


  1. Which of the below is not an implementation of List interface?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    SessionList is not an implementation of List interface. The others are concrete classes of List.



  1. What is the worst case complexity of accessing an element in ArrayList?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    ArrayList has O(1) complexity for accessing an element in ArrayList. O(n) is the complexity for accessing an element from LinkedList.


  1. When an array is passed to a method, will the content of the array undergo changes with the actions carried within the function?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    If we make a copy of array before any changes to the array the content will not change. Else the content of the array will undergo changes.



  1. What does Collections.emptySet() return?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    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.