Interview prompt
Explain how bits become values to an engineer who understands the surrounding system but has not used this technique. Walk from its contract to a concrete operation, then discuss where it fails or becomes expensive.
A strong answer
Memory stores bit patterns; a type and an operation determine how a program interprets those bits. The same sequence can represent an integer, a floating-point value, an instruction, or encoded text. Understanding representation explains overflow, precision loss, and why serialization formats must specify byte order and field meaning.
An unsigned w-bit integer represents values from zero through 2^w minus one. Two’s-complement signed integers reuse the same bit patterns with a different interpretation and arithmetic rules. Floating-point formats allocate bits to sign, exponent, and fraction, so many decimal fractions cannot be represented exactly.
A complete answer also calls out the assumptions that control correctness. Integer overflow behavior differs by language and type: some environments wrap, some trap, and some make signed overflow undefined. Floating-point rounding can make algebraic rearrangements change results. Treat external bytes as untrusted until length, encoding, and numeric range have been checked.
Close by describing one representative test or measurement. Why can a program not safely assume that adding a small decimal fraction repeatedly produces the exact mathematical result? Give one way to represent money when exact decimal arithmetic matters.
Follow-up questions
Answer the follow-ups in the frontmatter. Use the linked article for the concept and the trace to make the explanation concrete.