15 real STL Containers questions from the C++ bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.
1. What is std::vector?
Junior
A.the event where adding elements forces a container to reallocate or rebalance, leaving previously held iterators pointing to freed or moved storage
B.a contiguous dynamic array offering amortized constant-time append and random access, the default sequence container choice
C.a double-ended sequence container supporting efficient insertion and removal at both front and back without contiguous storage guarantees
D.an ordered associative container storing sorted unique keys, typically a balanced tree giving logarithmic lookup and ordered traversal
A.std::vector — a hash-table associative container giving average constant-time lookup but no ordering guarantee on its keys
B.std::vector — a contiguous dynamic array offering amortized constant-time append and random access, the default sequence container choice
C.std::vector — an ordered associative container storing sorted unique keys, typically a balanced tree giving logarithmic lookup and ordered traversal
D.std::vector — the event where adding elements forces a container to reallocate or rebalance, leaving previously held iterators pointing to freed or moved storage
5. Which term means: "an ordered associative container storing sorted unique keys, typically a balanced tree giving logarithmic lookup and ordered traversal"?
A.std::unordered_map — a hash-table associative container giving average constant-time lookup but no ordering guarantee on its keys
B.std::unordered_map — the event where adding elements forces a container to reallocate or rebalance, leaving previously held iterators pointing to freed or moved storage
C.std::unordered_map — a double-ended sequence container supporting efficient insertion and removal at both front and back without contiguous storage guarantees
D.std::unordered_map — a contiguous dynamic array offering amortized constant-time append and random access, the default sequence container choice
11. Which term means: "a double-ended sequence container supporting efficient insertion and removal at both front and back without contiguous storage guarantees"?
A.std::deque — an ordered associative container storing sorted unique keys, typically a balanced tree giving logarithmic lookup and ordered traversal
B.std::deque — the event where adding elements forces a container to reallocate or rebalance, leaving previously held iterators pointing to freed or moved storage
C.std::deque — a hash-table associative container giving average constant-time lookup but no ordering guarantee on its keys
D.std::deque — a double-ended sequence container supporting efficient insertion and removal at both front and back without contiguous storage guarantees
14. Which term means: "the event where adding elements forces a container to reallocate or rebalance, leaving previously held iterators pointing to freed or moved storage"?
A.Iterator invalidation — a double-ended sequence container supporting efficient insertion and removal at both front and back without contiguous storage guarantees
B.Iterator invalidation — the event where adding elements forces a container to reallocate or rebalance, leaving previously held iterators pointing to freed or moved storage
C.Iterator invalidation — an ordered associative container storing sorted unique keys, typically a balanced tree giving logarithmic lookup and ordered traversal
D.Iterator invalidation — a contiguous dynamic array offering amortized constant-time append and random access, the default sequence container choice
Answers, AI explanations, and a scored voice mock interview
Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.