250+ TOP MCQs on Float Datatype and Answers

tricky C Objective Questions on “Float Datatype”. One shall practice these tricky questions to improve their C programming skills needed for various interviews (campus interviews, walkin interviews, company interviews), placements, entrance exams and other competitive exams. These questions can be attempted by anyone focusing on learning C Programming language. They can be a beginner, fresher, engineering graduate or an experienced IT professional. Our C questions come with detailed explanation of the answers which helps in better understanding of C concepts.

Here is a listing of C Objective Questions on “Float Datatype” along with answers, explanations and/or solutions:

1. What will be the output of the following C code?

    #include 
    printf("%.0f", 2.89);

a) 2.890000
b) 2.89
c) 2
d) 3
Answer: d
Clarification: None.

2. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         float a = 2.455555555555;
  5.         printf("%f", a);
  6.     }

a) 2.455555
b) 2.455556
c) 2.456
d) 2.46
Answer: a
Clarification: 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;
Answer: c
Clarification: 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
Answer: c
Clarification: None.

5. Modulus for float could be achieved by?
a) a % b
b) modulus(a, b);
c) fmod(a, b);
d) mod(a, b);
Answer: c
Clarification: None.

6. Predict the data type of the following mathematical operation?

2 * 9 + 3 / 2 . 0

a) int
b) long
c) float
d) double
Answer: d
Clarification: None.

7. %lf is used to display?
a) float
b) long float
c) double
d) all of the mentioned
Answer: c
Clarification: None.

Leave a Reply

Your email address will not be published. Required fields are marked *