This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Float Datatype – 2”.
Pre-requisite for C Float Datatype MCQ set: Video Tutorial on C Data Types.
1. What will be the output of the following C code?
#include <stdio.h> printf("%.0f", 2.89);
a) 2.890000
b) 2.89
c) 2
d) 3
View Answer
Explanation: None.
2. What will be the output of the following C code?
#include <stdio.h>
int main()
{
float a = 2.455555555555;
printf("%f", a);
}
a) 2.455555
b) 2.455556
c) 2.456
d) 2.46
View Answer
Explanation: None.
3. Which of the following % operation is invalid?
a) 2 % 4;
b) 2 % 4l;
c) 2 % 4f;
d) Both 2 % 4l; and 2 % 4f;
View Answer
Explanation: None.
4. Which data type is suitable for storing a number like?
10.0000000001
a) int
b) float
c) double
d) both float and double
View Answer
Explanation: None.
5. Modulus for float could be achieved by?
a) a % b
b) modulus(a, b);
c) fmod(a, b);
d) mod(a, b);
View Answer
Explanation: None.
6. Predict the data type of the following mathematical operation?
2 * 9 + 3 / 2 . 0
a) int
b) long
c) float
d) double
View Answer
Explanation: None.
7. %lf is used to display?
a) float
b) long float
c) double
d) all of the mentioned
View Answer
Explanation: None.
Sanfoundry Global Education & Learning Series – C Programming Language.
To practice all areas of C language, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check C Books
- Practice BCA MCQs
- Apply for C Internship
- Check Computer Science Books
- Practice Computer Science MCQs