🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Java Collections (List and Set): all 10 questions

Quiz: Java Collections (List and Set) · Question 3 of 10

What is the time complexity of get(i) on an ArrayList?

What is the time complexity of get(i) on an ArrayList?

  1. A.O(1)
  2. B.O(n)
  3. C.O(log n)
  4. D.O(n²)
Answer & explanation

Correct answer: O(1)

ArrayList is backed by an array, so index access is direct.

Can you get the rest right without peeking?

Take the timed Quiz: Java Collections (List and Set) quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →