Functions
- What is the output of this program?
#include <iostream>
#include <algorithm>
using namespace std;
int main ()
{
cout << "Max Value (15, 12) = " << max(15, 12) << '\n';
cout << "Max Value (L, U) = " << max('L', 'U') << '\n';
return 0;
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
In this program, We found the max value in the given value by using max function.
- Which operator is used to compare the values to find min and max?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
<
- Which function is used to return the minimum element in the range?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
The min_element is used to compare the range of elements and it can find out the minimum element.
- How many parameters are needed for minmax function?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
The “minmax” function can take the following:
1 parameter: An initializer_list object.
2 parameters: Values to compare.
2 parameters: An initializer_list object. and comparison function
3 parameters: Values to compare. and comparison function
- What kind of functions are min and max in c++?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
The min/max functions are type specific but they will not force everything to be converted to/from floating point. The functions that will force everything to be converted to/from floating point are fmin/fmax.