PCEP-30-02 · Question #269
The most important difference between integer and floating-point numbers lies in the fact that:
The correct answer is A. they are stored differently in the computer memory. Integer and floating-point numbers use fundamentally different binary representations in memory: integers store exact whole values using fixed-width binary encoding, while floats use the IEEE 754 standard with separate bits for sign, exponent, and mantissa - enabling decimal…
Question
Options
- Athey are stored differently in the computer memory
- Bthey cannot be used simultaneously
- CIntegers cannot be literals, while oats can
How the community answered
(32 responses)- A84% (27)
- B6% (2)
- C9% (3)
Explanation
Integer and floating-point numbers use fundamentally different binary representations in memory: integers store exact whole values using fixed-width binary encoding, while floats use the IEEE 754 standard with separate bits for sign, exponent, and mantissa - enabling decimal precision but introducing rounding. This structural difference is the deepest distinction between the two types, affecting not just storage size but precision, range, and arithmetic behavior.
Why B is wrong: Integers and floats are used simultaneously all the time - mixing them in expressions is standard in virtually every programming language, with implicit or explicit type conversion handling the interaction.
Why C is wrong: Both integers and floats can be literals. 42 is an integer literal; 3.14 is a float literal. The claim is simply false.
Memory tip: Think "IEEE 754" - the floating-point standard exists precisely because floats needed a completely different storage scheme than integers. If they were stored the same way, there'd be no need for a separate standard.
Community Discussion
No community discussion yet for this question.