In the terminology used by the UGC NET August 2016 Paper II source, a function…
2016
In the terminology used by the UGC NET August 2016 Paper II source, a function template in C++ provides how many levels of generalization?
Answer: C. 2 — ConceptA C++ function template is a generic definition from which a family of concrete functions can be instantiated. The phrase “levels of generalization” is…
- A.
4
- B.
3
- C.
2
- D.
1
Attempted by 277 students.
Show answer & explanation
Correct answer: C
Concept
A C++ function template is a generic definition from which a family of concrete functions can be instantiated.
The phrase “levels of generalization” is historical exam terminology, not a formal count defined by the C++ standard; this item must therefore be read in the convention of its cited source.
Application
The cited UGC NET item and multiple exact-item answer compilations identify the displayed value 2.
Under the source’s simplified explanation,
template<typename T>represents type-based parameterization andtemplate<int N>represents compile-time value-based parameterization.
Cross-check and contrast
The value 4 is a different count from the source-keyed result.
The value 3 is a different count from the source-keyed result.
The value 2 is the value identified in the source answer.
The value 1 is a different count from the source-keyed result.
Modern C++ also permits template-template parameters, so that feature should not be used to invent a universal “level” count; the result here is explicitly the historical source convention.
Result
The source-keyed number of levels of generalization is 2.
Explore the full course: Mppsc Assistant Professor Computer Science Paper 2