Numbers


  1. Where does the member should be defined if it is used in the program?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    The member shall still be defined in a namespace scope if it is used in the program.


  1. What is the output of this program?
    #include <iostream>
    #include <limits>
    using namespace std;
    int main ()
    {
    cout << boolalpha;
    cout << numeric_limits<int> :: has_infinity << '\n';
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    In this program, We are checking whether the integer has limit or not by using has_infinity function.



  1. What will the max function in the numeric limit will return for type float?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Max function in the numeric limit will return the maximum finite value for a float type.


  1. What is the output of this program?
    #include <iostream>
    #include <limits>
    using namespace std;
    int main( )
    {
    cout << numeric_limits<short int> :: max() << endl;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    In this program, We are finding the max range for short int by using max function.



  1. To which type does the numeric limits are suitable?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Numeric limits provides the information about the properties of arithmetic types.