Civil Engineering Mechanical Engineering Chemical Engineering Networking Database Questions Computer Science Basic Electronics Digital Electronics Electronic Devices Circuit Simulation Electrical Enigneering Engineering Mechanics Technical Drawing

# C Programming - Floating Point Issues

@ : Home > C Programming > Floating Point Issues > General Questions

### Exercise

"Nothing in life is to be feared, it is only to be understood."
- Marie Curie
6.

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)

7.

The binary equivalent of 5.375 is

 A. 101.101 B. 101.011 C. 101011 D. None of above

8.

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

9.

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)

10.

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