Data Structures
- When an array is passed to a method, will the content of the array undergo changes with the actions carried within the function?
-
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.
- What is the worst case complexity of accessing an element in ArrayList?
-
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.
- Which of the below is not an implementation of List interface?
-
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.
- How to remove duplicates from List?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Duplicate elements are allowed in List. Set contains unique objects.
- How to sort elements of ArrayList?
-
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.