15 STL Containers questions from the C++ bank, written for Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd.
Free to start: the 2-minute IT readiness check — six questions and a result.
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
Answer + AI explanation with Pro
2. Which term means: "a contiguous dynamic array offering amortized constant-time append and random access, the default sequence container choice"?
Junior
A.std::map
B.Iterator invalidation
C.std::deque
D.std::vector
Answer + AI explanation with Pro
3. Which statement is correct?
Junior
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
Answer + AI explanation with Pro
4. What is std::map?
Mid
A.a contiguous dynamic array offering amortized constant-time append and random access, the default sequence container choice
B.a double-ended sequence container supporting efficient insertion and removal at both front and back without contiguous storage guarantees
C.an ordered associative container storing sorted unique keys, typically a balanced tree giving logarithmic lookup and ordered traversal
D.a hash-table associative container giving average constant-time lookup but no ordering guarantee on its keys
Answer + AI explanation with Pro
5. Which term means: "an ordered associative container storing sorted unique keys, typically a balanced tree giving logarithmic lookup and ordered traversal"?
Mid
A.std::unordered_map
B.std::deque
C.std::map
D.std::vector
Answer + AI explanation with Pro
6. Which statement is correct?
Mid
A.std::map — a hash-table associative container giving average constant-time lookup but no ordering guarantee on its keys
B.std::map — a double-ended sequence container supporting efficient insertion and removal at both front and back without contiguous storage guarantees
C.std::map — an ordered associative container storing sorted unique keys, typically a balanced tree giving logarithmic lookup and ordered traversal
D.std::map — a contiguous dynamic array offering amortized constant-time append and random access, the default sequence container choice
Answer + AI explanation with Pro
7. What is std::unordered_map?
Mid
A.an ordered associative container storing sorted unique keys, typically a balanced tree giving logarithmic lookup and ordered traversal
B.the event where adding elements forces a container to reallocate or rebalance, leaving previously held iterators pointing to freed or moved storage
C.a hash-table associative container giving average constant-time lookup but no ordering guarantee on its keys
D.a double-ended sequence container supporting efficient insertion and removal at both front and back without contiguous storage guarantees
Answer + AI explanation with Pro
8. Which term means: "a hash-table associative container giving average constant-time lookup but no ordering guarantee on its keys"?
Mid
A.std::unordered_map
B.std::vector
C.std::map
D.std::deque
Answer + AI explanation with Pro
9. Which statement is correct?
Mid
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
Answer + AI explanation with Pro
10. What is std::deque?
Mid
A.a contiguous dynamic array offering amortized constant-time append and random access, the default sequence container choice
B.a double-ended sequence container supporting efficient insertion and removal at both front and back without contiguous storage guarantees
C.an ordered associative container storing sorted unique keys, typically a balanced tree giving logarithmic lookup and ordered traversal
D.the event where adding elements forces a container to reallocate or rebalance, leaving previously held iterators pointing to freed or moved storage
Answer + AI explanation with Pro
11. Which term means: "a double-ended sequence container supporting efficient insertion and removal at both front and back without contiguous storage guarantees"?
Mid
A.std::deque
B.std::vector
C.Iterator invalidation
D.std::unordered_map
Answer + AI explanation with Pro
12. Which statement is correct?
Mid
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
Answer + AI explanation with Pro
13. What is Iterator invalidation?
Senior
A.a double-ended sequence container supporting efficient insertion and removal at both front and back without contiguous storage guarantees
B.the event where adding elements forces a container to reallocate or rebalance, leaving previously held iterators pointing to freed or moved storage
C.an ordered associative container storing sorted unique keys, typically a balanced tree giving logarithmic lookup and ordered traversal
D.a hash-table associative container giving average constant-time lookup but no ordering guarantee on its keys
Answer + AI explanation with Pro
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"?
Senior
A.std::map
B.std::vector
C.std::unordered_map
D.Iterator invalidation
Answer + AI explanation with Pro
15. Which statement is correct?
Senior
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
Answer + AI explanation with Pro
Free to start
Start with a free readiness check
Sign up free for the 2-minute IT readiness check and a scored result. Answers, explanations and the AI tutor on every STL Containers question come with Pro.