adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream>
    using namespace std;
    template <class T>
    inline T square(T x)
    {
        T result;
        result = x * x;
        return result;
    };
    template <>
    string square<string>(string ss)
    {
        return (ss+ss);
    };
    int main()     
    {
        int i = 4, ii;
        string ww("A");
        ii = square<int>(i);
        cout << i << ii;
        cout << square<string>(ww) << endl;
    }

a.

416AA

b.

164AA

c.

AA416

d.

none of the mentioned

Answer: (a).416AA

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?