What this C++ vector-construction question tests
This is a medium-difficulty C++ language-knowledge question that probes your understanding of how standard library containers are initialized and resized. It's the kind of detail that separates candidates who read documentation carefully from those who rely on intuition alone.
The question asks you to trace execution of a code snippet and predict its output. Success requires knowing the exact semantics of vector constructors, assignment operators, and how they interact with template argument deduction. Even small differences in initialization syntax—parentheses vs. braces, explicit sizing vs. value filling—produce different runtime behaviour, and interviewers expect you to predict that behaviour without running the code.
- Vector constructor overloads and their signatures
- Value initialization vs. default initialization
- Implicit vs. explicit conversions in container setup