Numbers
- Where does the member should be defined if it is used in the program?
-
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.
- 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;
}
-
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.
- What will the max function in the numeric limit will return for type float?
-
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.
- What is the output of this program?
#include <iostream>
#include <limits>
using namespace std;
int main( )
{
cout << numeric_limits<short int> :: max() << endl;
}
-
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.
- To which type does the numeric limits are suitable?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Numeric limits provides the information about the properties of arithmetic types.