Data Structures


  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 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. 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. How to remove duplicates from List?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Duplicate elements are allowed in List. Set contains unique objects.



  1. How to sort elements of ArrayList?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Collections provides a method to sort the list. The order of sorting can be defined using Comparator.