Vidyalelo
C++ Programming · Q378

C++ miscellaneous

Programming · C++ Programming · question 378

Q378

What will be the output of the following C++ code? #include using namespace std; template inline T square(T x) T result; result = x * x; return result; ; template <> string square (string ss) return (ss+ss); ; int main() int i = 2, ii; string ww("A"); ii = square (i); cout (ww) << ":" << endl;

A.
2: 4AA:
Answer
B.
2:4
C.
AA
D.
2:4A

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board