C- Floating Point Issues MCQ Questions and Answers

Practice Mode
Showing 10 of 28 questions
Q1
What are the different types of real data type in C ?
  • A float, double
  • B short int, double, long int
  • C float, double, long double
  • D double, long int, float
Answer: Option C
Q2
What will you do to treat the constant 3.14 as a long double?
  • A use 3.14LD
  • B use 3.14L
  • C use 3.14DL
  • D use 3.14LF
Answer: Option B
Q3
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; }
  • A #include<conio.h>
  • B #include<math.h>
  • C #include<stdlib.h>
  • D #include<dos.h>
Answer: Option B
Q4
We want to round off x, a float, to an int value, The correct way to do is
  • A y = (int)(x + 0.5)
  • B y = int(x + 0.5)
  • C y = (int)x + 0.5
  • D y = (int)((int)x + 0.5)
Answer: Option A
Q5
The binary equivalent of 5.375 is
  • A 101.101110111
  • B 101.011
  • C 101011
  • D None of above
Answer: Option B
Q6
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?
  • A ABCD
  • B DCBA
  • C 0xABCD
  • D Depends on big endian or little endian architecture
Answer: Option D
Q7
What will you do to treat the constant 3.14 as a float?
  • A use float(3.14f)
  • B use 3.14f
  • C use f(3.14)
  • D use (f)(3.14)
Answer: Option B
Q8
Which of the following statement obtains the remainder on dividing 5.5 by 1.3 ?
  • A rem = (5.5 % 1.3)
  • B rem = modf(5.5, 1.3)
  • C rem = fmod(5.5, 1.3)
  • D Error: we can't divide
Answer: Option C
Q9
What is the primary reason for floating-point representation errors in computing?
  • A Limited memory size
  • B Binary representation limitations
  • C Processor speed variations
  • D Programming language differences
Answer: Option B
Explanation: Binary systems cannot precisely represent all decimal fractions that terminate in base 10.
Q10
Which of the following decimal numbers can be represented exactly in binary floating-point format?
  • A 0.1
  • B 0.5
  • C 0.2
  • D 0.3
Answer: Option B
Explanation: Only numbers that are powers of 2 or sums of powers of 2 can be represented exactly in binary.
Questions and Answers for Competitive Exams Various Entrance Test