Templates and Generics interview questions

15 real Templates and Generics 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 Function template?

Junior
  1. A.a parameterized blueprint from which the compiler generates concrete functions by deducing or supplying type arguments
  2. B.an alternative definition supplied for a specific set of template arguments, overriding the primary template for those types
  3. C.the rule that an invalid substitution of template arguments removes a candidate from overload resolution rather than causing a hard error
  4. D.a template accepting an arbitrary number of arguments via a parameter pack that can be expanded recursively or with fold expressions
Reveal the answer + AI explanation — free account

2. Which term means: "a parameterized blueprint from which the compiler generates concrete functions by deducing or supplying type arguments"?

Junior
  1. A.Template specialization
  2. B.Concept (C++20)
  3. C.Function template
  4. D.Variadic template
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Junior
  1. A.Function template — a parameterized blueprint from which the compiler generates concrete functions by deducing or supplying type arguments
  2. B.Function template — the rule that an invalid substitution of template arguments removes a candidate from overload resolution rather than causing a hard error
  3. C.Function template — a named compile-time predicate on template arguments that constrains which types may instantiate a template and improves error messages
  4. D.Function template — an alternative definition supplied for a specific set of template arguments, overriding the primary template for those types
Reveal the answer + AI explanation — free account

4. What is Template specialization?

Mid
  1. A.the rule that an invalid substitution of template arguments removes a candidate from overload resolution rather than causing a hard error
  2. B.a template accepting an arbitrary number of arguments via a parameter pack that can be expanded recursively or with fold expressions
  3. C.a named compile-time predicate on template arguments that constrains which types may instantiate a template and improves error messages
  4. D.an alternative definition supplied for a specific set of template arguments, overriding the primary template for those types
Reveal the answer + AI explanation — free account

5. Which term means: "an alternative definition supplied for a specific set of template arguments, overriding the primary template for those types"?

Mid
  1. A.Concept (C++20)
  2. B.SFINAE
  3. C.Variadic template
  4. D.Template specialization
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Mid
  1. A.Template specialization — a named compile-time predicate on template arguments that constrains which types may instantiate a template and improves error messages
  2. B.Template specialization — a parameterized blueprint from which the compiler generates concrete functions by deducing or supplying type arguments
  3. C.Template specialization — an alternative definition supplied for a specific set of template arguments, overriding the primary template for those types
  4. D.Template specialization — a template accepting an arbitrary number of arguments via a parameter pack that can be expanded recursively or with fold expressions
Reveal the answer + AI explanation — free account

7. What is SFINAE?

Senior
  1. A.a template accepting an arbitrary number of arguments via a parameter pack that can be expanded recursively or with fold expressions
  2. B.the rule that an invalid substitution of template arguments removes a candidate from overload resolution rather than causing a hard error
  3. C.an alternative definition supplied for a specific set of template arguments, overriding the primary template for those types
  4. D.a named compile-time predicate on template arguments that constrains which types may instantiate a template and improves error messages
Reveal the answer + AI explanation — free account

8. Which term means: "the rule that an invalid substitution of template arguments removes a candidate from overload resolution rather than causing a hard error"?

Senior
  1. A.Template specialization
  2. B.SFINAE
  3. C.Function template
  4. D.Concept (C++20)
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Senior
  1. A.SFINAE — a template accepting an arbitrary number of arguments via a parameter pack that can be expanded recursively or with fold expressions
  2. B.SFINAE — the rule that an invalid substitution of template arguments removes a candidate from overload resolution rather than causing a hard error
  3. C.SFINAE — an alternative definition supplied for a specific set of template arguments, overriding the primary template for those types
  4. D.SFINAE — a parameterized blueprint from which the compiler generates concrete functions by deducing or supplying type arguments
Reveal the answer + AI explanation — free account

10. What is Concept (C++20)?

Mid
  1. A.an alternative definition supplied for a specific set of template arguments, overriding the primary template for those types
  2. B.the rule that an invalid substitution of template arguments removes a candidate from overload resolution rather than causing a hard error
  3. C.a parameterized blueprint from which the compiler generates concrete functions by deducing or supplying type arguments
  4. D.a named compile-time predicate on template arguments that constrains which types may instantiate a template and improves error messages
Reveal the answer + AI explanation — free account

11. Which term means: "a named compile-time predicate on template arguments that constrains which types may instantiate a template and improves error messages"?

Mid
  1. A.SFINAE
  2. B.Variadic template
  3. C.Function template
  4. D.Concept (C++20)
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Mid
  1. A.Concept (C++20) — a parameterized blueprint from which the compiler generates concrete functions by deducing or supplying type arguments
  2. B.Concept (C++20) — a named compile-time predicate on template arguments that constrains which types may instantiate a template and improves error messages
  3. C.Concept (C++20) — a template accepting an arbitrary number of arguments via a parameter pack that can be expanded recursively or with fold expressions
  4. D.Concept (C++20) — an alternative definition supplied for a specific set of template arguments, overriding the primary template for those types
Reveal the answer + AI explanation — free account

13. What is Variadic template?

Senior
  1. A.an alternative definition supplied for a specific set of template arguments, overriding the primary template for those types
  2. B.a template accepting an arbitrary number of arguments via a parameter pack that can be expanded recursively or with fold expressions
  3. C.the rule that an invalid substitution of template arguments removes a candidate from overload resolution rather than causing a hard error
  4. D.a named compile-time predicate on template arguments that constrains which types may instantiate a template and improves error messages
Reveal the answer + AI explanation — free account

14. Which term means: "a template accepting an arbitrary number of arguments via a parameter pack that can be expanded recursively or with fold expressions"?

Senior
  1. A.Function template
  2. B.Variadic template
  3. C.Template specialization
  4. D.Concept (C++20)
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Senior
  1. A.Variadic template — a parameterized blueprint from which the compiler generates concrete functions by deducing or supplying type arguments
  2. B.Variadic template — a template accepting an arbitrary number of arguments via a parameter pack that can be expanded recursively or with fold expressions
  3. C.Variadic template — a named compile-time predicate on template arguments that constrains which types may instantiate a template and improves error messages
  4. D.Variadic template — an alternative definition supplied for a specific set of template arguments, overriding the primary template for those types
Reveal the answer + AI explanation — free account

Free to start

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.

Practice Templates and Generics free