Paper Tayyari

Lecture 41: Template Functions

MCQs, short and long questions from lecture 41.Lecture 41 ki MCQs, short aur long sawal.

6 MCQs · 1 short · 4 long questions · 6 MCQs from past papers6 MCQs · 1 short · 4 long sawal · 6 MCQs past papers se

Start mock testMock test shuru karein
DoneHal kiye 0/6
– correctsahi
1.
★ Final term 2017 (paper 1)

A template function must have at least ________ generic data type.

  1. AZero
  2. BOne
  3. CTwo
  4. DThree

A function template needs at least one template type parameter.

2.
★ Final term 2017 (paper 2)

With template function, the compiler automatically detects the ______ and generates ______ using passed data.

  1. Apassed data, a new copy of function
  2. Bparameters, an old copy of function
  3. Cold copy of function, parameters
  4. Dparameters, an new copy of function

The compiler checks the type of the passed data and generates a new instance of the function for it.

3.
★ Final term solved MCQs (Moaaz & Asad)

With template function, the compiler automatically detects the passed data and generates a new copy of function using passed data.

  1. ATrue
  2. BFalse

The compiler deduces the argument types and instantiates a matching function.

4.
★ Final term solved MCQs (Moaaz & Asad)

A template function can have different type of arguments.

  1. ATrue
  2. BFalse

A function template may use several generic types and ordinary types as parameters.

5.
★ Final term solved MCQs (Moaaz & Asad)

A template function must have only generic data types.

  1. ATrue
  2. BFalse

A function template can mix generic and ordinary parameter types.

6.
★ Solved MCQs collection

The template functions do NOT promote the code reuse

  1. ATrue
  2. BFalse

Templates let one definition work for many types, which promotes reuse.