Select the correct option to test your answer:
Computer
Plus Plus Miscellaneous
Difficulty: Medium
What will be the output of the following C++ code? #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 = 2, ii; string ww("A"); ii = square<int>(i); cout << i << ": " << ii; cout << square<string>(ww) << ":" << endl; }
More Computer Questions
The punched card used in the IBM System/3 contains
Which of the following takes O(n) time in worst case in array implementation of stack?
Which of the following problems occur due to linear probing?
How is a hash table implemented in the case of open addressing?
Consider the following code: #include<stdio.h> int get_min(int a, int b) { if(a<b) return a; return b; } int minimum_time_required(int reach[][3],int spent[][4], int *entry, int *exit, int n) { int t1[n], t2[n],i; t1[0] = entry[0] + spent[0][0]; t2[0] = entry[1] + spent[1][0]; for(i = 1; i < n; i++) { t1[i] = get_min(t1[i-1]+spent[0][i], t2[i-1]+reach[1][i-1]+spent[0][i]); __________; } return get_min(t1[n-1]+exit[0], t2[n-1]+exit[1]); } Which of the following lines should be inserted to complete the above code?