🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Iterators in C++: all 10 questions

Quiz: Iterators in C++ · Question 10 of 10

Which container keeps iterators to other elements valid when you insert or erase?

Which container keeps iterators to other elements valid when you insert or erase?

  1. A.vector
  2. B.deque
  3. C.list
  4. D.string
Answer & explanation

Correct answer: list

In a list, inserting invalidates nothing and erasing invalidates only the erased element, because nodes never move.

Can you get the rest right without peeking?

Take the timed Quiz: Iterators in C++ quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →