Topic 4 · Notes

Data representation and data types

These notes are part of the Study subscription

11 sections covering the whole specification for this topic, with worked examples.

Preview

Bits, bytes and words

A bit (binary digit) is a single 0 or 1. It is the smallest unit of data a computer stores.

Unit Size
Nibble 4 bits
Byte 8 bits
Word The number of bits the processor handles as one unit, e.g. 32 or 64

With n bits you can make 2ⁿ different patterns. A byte gives 2⁸ = 256 patterns, so it can hold 0 to 255 as an unsigned integer.

Kilo or kibi? Strictly, a kilobyte (kB) is 1000 bytes and a kibibyte (KiB) is 1024 bytes. Many textbooks and exam papers still use KB to mean 1024, so read the question carefully and state which you are using.

Also in these notes

  • Binary and hexadecimalAS
  • Character setsAS
  • Primitive data typesAS
  • Negative numbers: sign and magnitude, two's complementAS
  • Floating pointAS
  • Binary arithmeticA2
  • Converting real numbers to floating pointA2
  • Truncation, rounding and accuracyA2
  • Logical and arithmetic shiftsA2
  • Overflow and underflowA2