Home / MCQ Bank / Computer
Computer Plus Plus Miscellaneous

What will be the output of the following C++ code? #include <iostream> #include <string> #include <cstring> using namespace std; template <class type> type MyMax(const type Var1, const type Var2) { cout << "no specialization"; return Var1 < Var2 ? Var2 : Var1; } template <> const char *MyMax(const char *Var1, const char *Var2) { return (strcmp(Var1, Var2)<0) ? Var2 : Var1; } int main() { string Str1 = "class", Str2 = "template"; const char *Var3 = "class"; const char *Var4 = "template"; const char *q = MyMax(Var3, Var4); cout << q << endl; return 0; }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option A • template

Related Computer Questions

What are the actual parameters in C++? Which of these occupy first 0 to 127 in Unicode character set used for characters in Java? Who coined the term 'backtracking'? What produces result sets? What will be the output of the following Java program? import java.util.*; class Maps { public static void main(String args[]) { HashMap obj = new HashMap(); obj.put("A", new Integer(1)); obj.put("B", new Integer(2)); obj.put("C", new Integer(3)); System.out.println(obj); } }