Templates and Generics interview questions

15 Templates and Generics 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.

Take the free IT readiness check

or take a mock interview set up for this area

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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)

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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)

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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)

Answer + AI explanation with Pro

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

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 Templates and Generics question come with Pro.

Take the free IT readiness check

or take a mock interview set up for this area

24,000+ questions & coding problemsSoftware & IT16,274 questionsGovernment jobs26 examsAptitudenew questions every timeAI practice interviewwith feedback65 topics to practiseMechanical1,149 questionsGATE ME9 papersEngineering Mathematics381 questions2-minute checkfreeDSA Problems1,422Civil1,005 questionsGATE CE9 papersCS Fundamentals1,209 questionsYour scores6 skillsSystem Design25Electrical / EEE1,047 questionsGATE EE9 papersRun your codeC++ · Java · PythonLow-Level Design144Electronics & Comm.975 questionsGATE EC9 papersAI help on every questionFull-Stack6,282Chemical1,005 questionsGATE CH9 papersAI whiteboardsystem designWork abroadEurope · remote · transfersESE ME1 paperGATE practice papers2019–2026ESE CE1 paperDate alertsbefore the last dateESE EE1 paperBehavioural courseHR round practiceESE ET1 paperResume optimizerProSSC JE ME1 paperApplication trackerSSC JE CE1 paperCompany-wise prepSSC JE EE1 paperRole roadmapsRRB JE1 subjectPriced in ₹UPI · cardsISRO SC1 paperGATE CS9 papersIBPS SO IT1 paperUGC NET CS1 paperSSC CGL26 papersIBPS PO26 papersRRB NTPC26 papersSSC CHSL26 papersIBPS Clerk26 papersSBI Clerk26 papersRRB Group D26 papersSSC CPO26 papersSSC GD26 papers