Data Representation (8hrs) · Computer Fundamentals & Emerging Technologies

Data Representation & Number Systems

Watch lectures

Data Representation & Number Systems

1. Why Data Representation is Needed

A digital computer is built from two-state devices — a transistor is either on (1) or off (0). It therefore understands only binary, and every kind of information must be encoded as a pattern of bits: numbers, characters, images, audio, video and even the instructions of a program. Data representation is the set of rules for that encoding.

Data type How it is represented Unit of measurement
Integers Positional binary, signed or unsigned bit / byte
Real numbers Floating point (IEEE-754: sign, exponent, mantissa) bit
Characters ASCII (8-bit), Unicode (8/16/32-bit), BCD for digits byte
Images Grid of pixels, each with a colour code (colour depth) pixels × bits per pixel
Audio Amplitude sampled at fixed intervals samples/s (Hz) × bit depth
Video Sequence of frames + compression frames/s + bit rate
Instructions Opcode + operand fields bits per instruction word

2. Positional Number Systems

In a positional system, the value of a digit depends on its position. With radix (base) rr and digits dd:

Value=dn−1×rn−1+...+d1×r1+d0×r0+d−1×r−1+...Value = d_{n-1} × r^{n-1} + ... + d_1 × r^{1} + d_0 × r^{0} + d_{-1} × r^{-1} + ...

Two ideas follow directly from this: any base works, and the base tells you how many symbols are needed.

3. The Four Systems Used in Computing

System Base (radix) Digits allowed Suffix examples Why used
Binary 2 0, 1 101121011_2 or 1011B Native machine language; simple, reliable two-state circuits
Octal 8 0-7 6538653_8 or 653O Compact shorthand for binary — 1 octal digit = 3 bits
Decimal 10 0-9 987 or 987D Human everyday arithmetic
Hexadecimal 16 0-9, A-F (A=10 … F=15) 2AF162AF_{16} or 2AFH Compact shorthand — 1 hex digit = 4 bits; used for addresses, memory dumps, MAC addresses
BCD 10 (as 4-bit groups) 0000-1001 25 → 0010 0101 Exact decimal arithmetic (calculators, banking); wastes 6 of 16 codes
Gray code 2 (reflected) 0, 1 3 → 0010 Only one bit changes between consecutive codes; used in encoders, K-maps

4. Counting in All Four Systems

Decimal Binary (4-bit) Octal Hex
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F

5. Why Binary is Used in Computers

  1. Only two stable states (saturated / cut-off transistor, charged / discharged capacitor) — highly reliable and noise-resistant.
  2. Simple circuits — one circuit (adder) handles all arithmetic; Boolean logic maps directly onto gates.
  3. Cheap and easy to build with switches, relays, magnetic and optical media.
  4. Arithmetic and error-control (parity, checksums) are simplest in base 2.
    Octal and hexadecimal exist purely as human-friendly shorthands for binary: one digit condenses 3 or 4 bits, so long addresses become readable.

6. How Many Bits Do You Need?

To represent nn distinct values you need kk bits where

2k≥n,thatis,k=⌈log2n⌉2^{k} ≥ n, that is, k = ⌈log₂ n⌉
Values to represent Bits needed Example
10 digits 4 BCD
26 letters 5 (25=322^{5}=32) one alphabet
128 ASCII characters 7 (stored in 8) ASCII
65,536 characters 16 Unicode BMP
256 colours 1 byte per pixel GIF palette image

7. Exam Points

  • Why are octal and hexadecimal used in computer work? — 3-5 marks, very frequent.
  • Explain the positional number system with the general formula — 5 marks.
  • Compare binary, octal, decimal and hexadecimal with digits and base — 5 marks.
  • What is BCD? Why is it used in calculators? — 3 marks.
  • How many bits are needed to represent n characters/values? — 3 marks numerical.
  • How are pictures, sound and characters represented in a computer? — 5 marks.
Free AppAndroid App

Coursify Android App

Generate AI courses, take quick quizzes between classes, and master complex engineering concepts on the go.

← All Computer Fundamentals & Emerging Technologies modules