In this program, We are passing the value to the template and printing it in the template.
Question 5. How to declare a template?
tem
temp
template < >
none of the mentioned
Explanation:-
Answer: Option C. -> template < >
template < >
Question 6. What may be the name of the parameter that the template should take?
same as template
same as class
same as function
none of the mentioned
Explanation:-
Answer: Option A. -> same as template
same as template
Question 7. Which are done by compiler for templates?
type-safe
portability
code elimination
all of the mentioned
Explanation:-
Answer: Option A. -> type-safe
The compiler can determine at compile time whether the type associated with a template definition can perform all of the functions required by that template definition.
Question 8. How many parameters are legal for non-type template?
1
2
3
4
Explanation:-
Answer: Option D. -> 4
The following are legal for non-type template parameters: integral or enumeration type, Pointer to object or pointer to function, Reference to object or reference to function, Pointer to member.
Question 9. Which is used to describe the function using placeholder types?
template parameters
template type parameters
template type
none of the mentioned
Explanation:-
Answer: Option B. -> template type parameters
During runtime, We can choose the appropriate type for the function and it is called as template type parameters.
Question 10. What is a function template?
creating a function without having to specify the exact type.
creating a function with having a exact type.
both a & b
none of the mentioned
Explanation:-
Answer: Option A. -> creating a function without having to specify the exact type.
creating a function without having to specify the exact type.