MCQs
Total Questions : 5
Answer: Option C. -> a or b
None.
Answer: Option C. -> constant expression
Non-type template parameters provide the ability to pass a constant expression at compile time.
The constant expression may also be an address of a function, object or static class member.
Answer: Option C. -> constant expression
Answer:d
Explanation:In this program, We are using the for loop to increment the value by 1 in the function template.
Output:
$ g++ ftemp5.cpp
$ a.out
2.1
3.1
4.1
Answer: Option C. -> constant expression
Answer:a
Explanation:In this program, We are passing the values and calculating the square of the value by using the function template.
Output:
$ g++ ftemp4.cpp
$ a.out
2 4
2.2 4.84
Answer: Option B. -> 200
In this program, We are using class to pass the value and then we are manipulating it.
Output:
$ g++ ftemp3.cpp
$ a.out
200