Home / CSE MCQs / C++ - MCQs :: Discussion

Discussion :: C++ - MCQs

  1. What is the output of this program?

    #include < iostream >
    #include < string >
    using namespace std;
    template < typename T >
    void print_mydata(T output)
    {
    cout << output << endl;
    }
    int main()
    {
    double d = 5.5;
    string s("Hello World");
    print_mydata( d );
    print_mydata( s );
    return 0;
    }
  2. A.

    5.5

     Hello World

    B.
    5.5
    C.
    Hello World
    D.
    none of the mentioned

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    In this program, We are passing the value to the template and printing it in the template.


Be The First To Comment