🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Operators and Templates: all 10 questions

Quiz: Operators and Templates · Question 9 of 10

When does the compiler generate code from a function template?

When does the compiler generate code from a function template?

  1. A.When the template is defined, for every type
  2. B.When the template is used with a particular type (instantiation)
  3. C.At run time, when the function is first called
  4. D.Never; templates are interpreted
Answer & explanation

Correct answer: When the template is used with a particular type (instantiation)

Each distinct type used produces its own compiled version of the function.

Can you get the rest right without peeking?

Take the timed Quiz: Operators and Templates quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →