Functions


  1. 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;
    }











  1. 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.


  1. Which operator is used to compare the values to find min and max?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    <



  1. Which function is used to return the minimum element in the range?











  1. 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.


  1. How many parameters are needed for minmax function?











  1. 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



  1. What kind of functions are min and max in c++?











  1. 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.