Question

Consider the array arr = [1, 2, 3, 4, 5] and the following operations: 1.  arr.insert(2, 9) (inserts 9 at index 2) 2.  arr.pop(3) (removes element at index 3) What is the final state of the array arr after these operations?

A [1, 2, 9, 4, 5]
B [1, 2, 9, 5]
C [1, 9, 2, 4, 5]
D [1, 9, 2, 5]
E [1, 2, 3, 9, 5]
Practice Next

Hey! Ask a query