1. Which of the following is not one of the sizes of the floating point types?
a) short float
b) float
c) long double
d) double
2. Which of the following is a valid floating point literal?
a) f287.333
b) F287.333
c) 287.e2
d) 287.3.e2
3. What is the range of the floating point numbers?
a) -3.4E+38 to +3.4E+38
b) -3.4E+38 to +3.4E+34
c) -3.4E+38 to +3.4E+36
d) -3.4E+38 to +3.4E+32
4. Which of three sizes of floating point types should be used when extended precision is required?
a) float
b) double
c) long double
d) extended float
5. What is the output of this program?
a) Vansh
b) Sharma
c) compile time error
d) runtime error
6. What is the output of this program?
a) 0.11
b) 0.10000000000000001
c) 0.100001
d) compile time error
7. What is the output of the following program?
a) 123.00
b) 1.23
c) 123
d) compile time error
8. Which is used to indicate single precision value?
a) F or f
b) L or l
c) either a or b
d) neither a or b
9. What is the output of this program?
a) equal
b) not equal
c) compile time error
d) runtime error
10. Which is correct with respect to size of the datatypes?
a) char > int < float
b) int < char > float
c) char < int < float
d) double < char > int
a) short float
b) float
c) long double
d) double
Answer:a
2. Which of the following is a valid floating point literal?
a) f287.333
b) F287.333
c) 287.e2
d) 287.3.e2
Answer:c
3. What is the range of the floating point numbers?
a) -3.4E+38 to +3.4E+38
b) -3.4E+38 to +3.4E+34
c) -3.4E+38 to +3.4E+36
d) -3.4E+38 to +3.4E+32
Answer:a
4. Which of three sizes of floating point types should be used when extended precision is required?
a) float
b) double
c) long double
d) extended float
Answer:c
5. What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
float num1 = 1.1;
double num2 = 1.1;
if (num1 == num2)
cout << "Vansh";
else
cout << "Sharma";
return 0;
}
b) Sharma
c) compile time error
d) runtime error
Answer:a
6. What is the output of this program?
#include <iomanip>
#include <iostream>
using namespace std;
int main()
{
cout << setprecision(17);
double d = 0.1;
cout << d << endl;
return 0;
}
b) 0.10000000000000001
c) 0.100001
d) compile time error
Answer:b
7. What is the output of the following program?
#include <iostream>
using namespace std;
int main()
{
float i = 123.0f;
cout << i << endl;
return 0;
}
b) 1.23
c) 123
d) compile time error
Answer:c
8. Which is used to indicate single precision value?
a) F or f
b) L or l
c) either a or b
d) neither a or b
Answer:a
9. What is the output of this program?
#include <iostream>
using namespace std;
int main()
{
float f1 = 0.5;
double f2 = 0.5;
if (f1 == 0.5f)
cout << "equal";
else
cout << "not equal";
return 0;
}
b) not equal
c) compile time error
d) runtime error
Answer:a
10. Which is correct with respect to size of the datatypes?
a) char > int < float
b) int < char > float
c) char < int < float
d) double < char > int
Answer:c