Given the following collection of integers stored in a Linkedist 3,8, 23, 1, 900
ID: 3592064 • Letter: G
Question
Given the following collection of integers stored in a Linkedist 3,8, 23, 1, 900, 45, 16, 37,54,276,6 suppose you have an iterator traversing the list, and that this iterator is currently pointing to the item, '16. Before the iterator moves to the next item in its traversal, suppose the integer 92 is added at position 7 of the list, between the 16 and the 37, using the add(Object obj, int index) method of the LinkedList class. What value will the iterator be pointing to after the '9Z has been added? O 92 037 O no value O 16Explanation / Answer
Answer:- Option D
Explanation:-
If iterator is pointing to 16 and 92 is added at index 7 using add(int index,Object obj), then the position of iterator after adding 92 is same as the previous it means there is no change in the iterator position and iterator pointing to 16.
it happend because, Linklist is growable in nature it means it shift the all element of Linklst after inserting new value.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.