CPP

CPP

Min and Max has 7 Questions
Which keyword is used to declare the min and max functions?

iostream
string
algorithm
None of the mentioned
What kind of functions are min and max in c++?

Type specific
Variable specific
Both a & b
None of the mentioned
What is the output of this program?
  1.     #include    
  2.     #include   
  3.     using namespace std;
  4.     int main () 
  5.     {
  6.         cout << "max(1, 2) == " << max(1, 2) << '\n';
  7.         cout << "max('a', 'z') == " << max('a', 'z') << '\n';
  8.         return 0;
  9.     }

2z
2a
Error
None of the mentioned
Which function is used to return the minimum element in the range?

min
minimum
min_element
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     #include 
  4.     using namespace std;
  5.     bool mygreater (int i,int j) 
  6.     {
  7.         return (i > j);
  8.     }
  9.     int main () 
  10.     {
  11.         int myints[] = {10, 20, 30, 30, 20, 10, 10, 20};
  12.         vector<int> v(myints, myints + 8);
  13.         pair<vector<int> :: iterator, vector<int> :: iterator> bounds;
  14.         sort (v.begin(), v.end());
  15.         bounds = equal_range (v.begin(), v.end(), 20);
  16.         cout  << (bounds.first - v.begin());
  17.         cout << " and " << (bounds.second - v.begin()) << '\n';
  18.         return 0;
  19.     }

3 and 6
2 and 5
3 and 5
2 and 4
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main ()
  5.     {
  6.         cout << min(2, 1) << ' ';
  7.         cout << min('m','m') << '\n';
  8.         return 0;
  9.     }

Error
Runtime error
1 m
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     #include 
  4.     using namespace std;
  5.     int main () 
  6.     {
  7.         int myints[] = {10, 20, 30, 30, 20, 10, 10, 20};
  8.         vector<int> v(myints, myints + 8);
  9.         sort (v.begin(), v.end());
  10.         vector<int> :: iterator low, up;
  11.         low = lower_bound (v.begin(), v.end(), 20);
  12.         up = upper_bound (v.begin(), v.end(), 20);
  13.         cout << (low - v.begin()) << ' ';
  14.         cout << (up - v.begin()) << '\n';
  15.         return 0;
  16.     }

3 6
2 5
2 6
2 4