C- Floating Point Issues MCQ

C- Floating Point Issues MCQ
1. What are the different types of real data type in C ?
  • float, double
  • short int, double, long int
  • float, double, long double
  • double, long int, float
Show Answer
2. What will you do to treat the constant 3.14 as a long double?
  • use 3.14LD
  • use 3.14L
  • use 3.14DL
  • use 3.14LF
Show Answer
3. Which statement will you add in the following program to work it correctly?
#include<stdio.h>
int main()
{
    printf("%f\n", log(36.0));
    return 0;
}

  • #include
  • #include
  • #include
  • #include
Show Answer
4. We want to round off x, a float, to an int value, The correct way to do is
  • y = (int)(x + 0.5)
  • y = int(x + 0.5)
  • y = (int)x + 0.5
  • y = (int)((int)x + 0.5)
Show Answer
5. The binary equivalent of 5.375 is


  • 101.101110111
  • 101.011
  • 101011
  • None of above
Show Answer
6. A float occupies 4 bytes. If the hexadecimal equivalent of these 4 bytes are A, B, C and D, then when this float is stored in memory in which of the following order do these bytes gets stored?
  • ABCD
  • DCBA
  • 0xABCD
  • Depends on big endian or little endian architecture
Show Answer
7. What will you do to treat the constant 3.14 as a float?
  • use float(3.14f)
  • use 3.14f
  • use f(3.14)
  • use (f)(3.14)
Show Answer
8. Which of the following statement obtains the remainder on dividing 5.5 by 1.3 ?
  • rem = (5.5 % 1.3)
  • rem = modf(5.5, 1.3)
  • rem = fmod(5.5, 1.3)
  • Error: we can't divide
Show Answer
Questions and Answers for Competitive Exams Various Entrance Test