15 Modern C++ 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.a non-owning lightweight view over a contiguous sequence of elements, carrying a pointer and length without copying the data
B.a specifier marking a function or variable as evaluable at compile time, allowing its result to be used in constant expressions
C.a C++17 declaration that unpacks a tuple, pair, array, or struct into several named variables in one statement
D.a type-safe tagged union holding exactly one value from a fixed set of alternative types, accessed via visitation
Answer + AI explanation with Pro
2. Which term means: "a specifier marking a function or variable as evaluable at compile time, allowing its result to be used in constant expressions"?
Mid
A.constexpr
B.std::optional
C.std::span
D.Structured bindings
Answer + AI explanation with Pro
3. Which statement is correct?
Mid
A.constexpr — a specifier marking a function or variable as evaluable at compile time, allowing its result to be used in constant expressions
B.constexpr — a non-owning lightweight view over a contiguous sequence of elements, carrying a pointer and length without copying the data
C.constexpr — a type-safe tagged union holding exactly one value from a fixed set of alternative types, accessed via visitation
D.constexpr — a C++17 declaration that unpacks a tuple, pair, array, or struct into several named variables in one statement
Answer + AI explanation with Pro
4. What is Structured bindings?
Mid
A.a specifier marking a function or variable as evaluable at compile time, allowing its result to be used in constant expressions
B.a wrapper that either contains a value or is empty, expressing a possibly-absent result without resorting to sentinels or pointers
C.a non-owning lightweight view over a contiguous sequence of elements, carrying a pointer and length without copying the data
D.a C++17 declaration that unpacks a tuple, pair, array, or struct into several named variables in one statement
Answer + AI explanation with Pro
5. Which term means: "a C++17 declaration that unpacks a tuple, pair, array, or struct into several named variables in one statement"?
Mid
A.constexpr
B.Structured bindings
C.std::optional
D.std::variant
Answer + AI explanation with Pro
6. Which statement is correct?
Mid
A.Structured bindings — a specifier marking a function or variable as evaluable at compile time, allowing its result to be used in constant expressions
B.Structured bindings — a C++17 declaration that unpacks a tuple, pair, array, or struct into several named variables in one statement
C.Structured bindings — a non-owning lightweight view over a contiguous sequence of elements, carrying a pointer and length without copying the data
D.Structured bindings — a type-safe tagged union holding exactly one value from a fixed set of alternative types, accessed via visitation
Answer + AI explanation with Pro
7. What is std::optional?
Mid
A.a wrapper that either contains a value or is empty, expressing a possibly-absent result without resorting to sentinels or pointers
B.a non-owning lightweight view over a contiguous sequence of elements, carrying a pointer and length without copying the data
C.a specifier marking a function or variable as evaluable at compile time, allowing its result to be used in constant expressions
D.a type-safe tagged union holding exactly one value from a fixed set of alternative types, accessed via visitation
Answer + AI explanation with Pro
8. Which term means: "a wrapper that either contains a value or is empty, expressing a possibly-absent result without resorting to sentinels or pointers"?
Mid
A.Structured bindings
B.std::optional
C.std::span
D.constexpr
Answer + AI explanation with Pro
9. Which statement is correct?
Mid
A.std::optional — a specifier marking a function or variable as evaluable at compile time, allowing its result to be used in constant expressions
B.std::optional — a type-safe tagged union holding exactly one value from a fixed set of alternative types, accessed via visitation
C.std::optional — a wrapper that either contains a value or is empty, expressing a possibly-absent result without resorting to sentinels or pointers
D.std::optional — a non-owning lightweight view over a contiguous sequence of elements, carrying a pointer and length without copying the data
Answer + AI explanation with Pro
10. What is std::variant?
Senior
A.a non-owning lightweight view over a contiguous sequence of elements, carrying a pointer and length without copying the data
B.a wrapper that either contains a value or is empty, expressing a possibly-absent result without resorting to sentinels or pointers
C.a C++17 declaration that unpacks a tuple, pair, array, or struct into several named variables in one statement
D.a type-safe tagged union holding exactly one value from a fixed set of alternative types, accessed via visitation
Answer + AI explanation with Pro
11. Which term means: "a type-safe tagged union holding exactly one value from a fixed set of alternative types, accessed via visitation"?
Senior
A.Structured bindings
B.std::variant
C.std::optional
D.std::span
Answer + AI explanation with Pro
12. Which statement is correct?
Senior
A.std::variant — a C++17 declaration that unpacks a tuple, pair, array, or struct into several named variables in one statement
B.std::variant — a wrapper that either contains a value or is empty, expressing a possibly-absent result without resorting to sentinels or pointers
C.std::variant — a type-safe tagged union holding exactly one value from a fixed set of alternative types, accessed via visitation
D.std::variant — a non-owning lightweight view over a contiguous sequence of elements, carrying a pointer and length without copying the data
Answer + AI explanation with Pro
13. What is std::span?
Senior
A.a type-safe tagged union holding exactly one value from a fixed set of alternative types, accessed via visitation
B.a non-owning lightweight view over a contiguous sequence of elements, carrying a pointer and length without copying the data
C.a C++17 declaration that unpacks a tuple, pair, array, or struct into several named variables in one statement
D.a specifier marking a function or variable as evaluable at compile time, allowing its result to be used in constant expressions
Answer + AI explanation with Pro
14. Which term means: "a non-owning lightweight view over a contiguous sequence of elements, carrying a pointer and length without copying the data"?
Senior
A.std::span
B.Structured bindings
C.constexpr
D.std::optional
Answer + AI explanation with Pro
15. Which statement is correct?
Senior
A.std::span — a C++17 declaration that unpacks a tuple, pair, array, or struct into several named variables in one statement
B.std::span — a non-owning lightweight view over a contiguous sequence of elements, carrying a pointer and length without copying the data
C.std::span — a type-safe tagged union holding exactly one value from a fixed set of alternative types, accessed via visitation
D.std::span — a specifier marking a function or variable as evaluable at compile time, allowing its result to be used in constant expressions
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 Modern C++ question come with Pro.