Understand how and why hexadecimal is used as a beneficial method of data representation

Data Representation – Number Systems

1. Why is hexadecimal used?

Hexadecimal (base‑16) is a compact, human‑readable way of representing binary data. One hexadecimal digit (a “hex digit”) corresponds exactly to four binary bits (a “nibble”). This relationship means that large binary numbers can be written with far fewer characters, making it easier to:

  • Read and write memory addresses.
  • Interpret machine code and colour values in graphics.
  • Debug programs by comparing binary patterns with a short notation.

2. Converting between number systems

2.1 Binary ↔ Decimal (Denary)

Binary → Decimal

Example: 101101₂
  1. Write the powers of 2 under each bit (right‑most bit = 2⁰).
  2. Multiply each bit by its power of 2 and add the results.
Bit2⁵2⁴2⁰
Value101101

Calculation: 1·32 + 0·16 + 1·8 + 1·4 + 0·2 + 1·1 = 45₁₀

Decimal → Binary

Example: 156₁₀
  1. Divide the number by 2, record the remainder.
  2. Repeat with the quotient until it becomes 0.
  3. Read the remainders in reverse order.
DivisionQuotientRemainder
156 ÷ 2780
78 ÷ 2390
39 ÷ 2191
19 ÷ 291
9 ÷ 241
4 ÷ 220
2 ÷ 210
1 ÷ 201

Reading the remainders bottom‑up gives 10011100₂.

2.2 Decimal ↔ Hexadecimal

Decimal → Hexadecimal

Example: 156₁₀ → ?₁₆
  1. Divide the decimal number by 16, keep the remainder.
  2. Repeat with the quotient until it becomes 0.
  3. Write the remainders in reverse order, using A‑F for values 10‑15.
DivisionQuotientRemainder
156 ÷ 16912 (C)
9 ÷ 1609

Result: 9C₁₆.

Hexadecimal → Decimal

Example: 0x7F → ?₁₀
  • 7 × 16¹ = 112
  • F (15) × 16⁰ = 15

Sum = 112 + 15 = 127₁₀.

2.3 Binary ↔ Hexadecimal (quick conversion)

Group binary digits into nibbles (4 bits) starting from the right‑most side, then replace each nibble with its hex equivalent.

Example: 101101110010₂ → ?₁₆
Binary nibbleHex digit
1011B
01117
00102

Result: B72₁₆.

2.4 Quick‑reference tables (syllabus‑friendly)

These tables show the maximum values for 8‑bit and 16‑bit unsigned numbers and give the direct conversion triples.

BitsMaximum unsigned value (Dec)Binary (full)Hex
8 bits2551111 1111₂FF₁₆
16 bits65 5351111 1111 1111 1111₂FFFF₁₆
Binary (4 bits)HexDecimal
000000
000111
001022
001133
010044
010155
011066
011177
100088
100199
1010A10
1011B11
1100C12
1101D13
1110E14
1111F15

3. Binary arithmetic, overflow and logical shifts

3.1 Overflow in an 8‑bit register

Computers usually work with fixed‑size bytes (8 bits). The largest unsigned value that can be stored in one byte is 255₁₀ (11111111₂). Adding two numbers that exceed this limit produces an overflow – the carry out of the most‑significant bit is discarded.

Example: 150₁₀ + 130₁₀
  • 150₁₀ = 10010110₂
  • 130₁₀ = 10000010₂
  • Binary addition: 10010110
    +10000010
    -----------
    1 00011000 (9‑bit result)
  • Discard the left‑most carry → 00011000₂ = 24₁₀.

The mathematically correct sum is 280₁₀, but an 8‑bit register can only hold 24₁₀; the discarded carry sets the overflow flag.

3.2 Logical shifts

A logical shift moves all bits left or right, inserting 0s into the vacated positions. It is used for fast multiplication/division by powers of two.

  • Logical left shift (<< 1): 00110101₂ → 01101010₂ (value doubles).
  • Logical right shift (>> 1): 11001010₂ → 01100101₂ (value halves, highest bit becomes 0).

Logical shifts treat the number as unsigned; the sign bit is not preserved.

3.3 Two’s‑complement representation of negative numbers

Two’s‑complement allows a single binary pattern to represent both positive and negative integers.

  1. Write the absolute value in binary (using the required number of bits).
  2. Invert every bit (0 → 1, 1 → 0).
  3. Add 1 to the inverted result.

Example: –45₁₀ in an 8‑bit system

  • 45₁₀ = 00101101₂
  • Invert → 11010010₂
  • Add 1 → 11010011₂

Thus, –45₁₀ is stored as 11010011₂. To verify, add the positive and negative forms:

 00101101
+11010011
-----------
100000000   (extra carry discarded → 00000000)

4. Hexadecimal in memory addressing

Modern computers address memory in bytes. Since a byte consists of 8 bits (two nibbles), a memory address is naturally expressed in hexadecimal.

Example address: 0x3F2A → binary 0011 1111 0010 1010. Using hexadecimal reduces a 16‑bit address to just four readable characters.

5. Common uses of hexadecimal

  • Representing colour values in HTML/CSS (e.g., #FF5733).
  • Displaying machine code and instruction sets.
  • Debugging memory dumps and stack traces.
  • Specifying Unicode code points (e.g., U+00E9 for “é”).

6. Character sets – ASCII and Unicode (hex view)

Both ASCII and Unicode assign a hexadecimal code point to each character. The table below shows a small sample relevant to the IGCSE syllabus.

CharASCII (Dec)ASCII (Hex)Unicode (U+)
A6541U+0041
a9761U+0061
04830U+0030
Space3220U+0020
U+20AC
éU+00E9

7. File‑size calculation example (image data)

File size (in bytes) = (width × height × colour‑depth) ÷ 8.

Example: A 1920 × 1080 pixel image with 24‑bit colour (true colour).
  • Pixels = 1920 × 1080 = 2 073 600.
  • Total bits = 2 073 600 × 24 = 49 766 400 bits.
  • Bytes = 49 766 400 ÷ 8 = 6 220 800 bytes ≈ 5.93 MiB.

8. Quick reference diagram

Side‑by‑side illustration of a binary byte split into two nibbles, each labelled with its hexadecimal equivalent.

Data Transmission

1. Packet structure

A data packet is the basic unit of communication in most networks. The typical layout is:

FieldPurpose
HeaderContains source/destination addresses, packet type, length, and error‑checking information (e.g., CRC).
Payload (Data)The actual user data being transferred.
TrailerOften a frame‑check sequence or other end‑of‑packet marker.

2. Packet‑switching vs. circuit‑switching

  • Packet‑switching: Data is broken into packets that travel independently; each packet may follow a different route. Used in the Internet, Ethernet, Wi‑Fi.
  • Circuit‑switching: A dedicated path is established for the duration of a communication session (e.g., traditional telephone networks).

3. Transmission modes

ModeDirectionTypical use
SimplexOne‑way onlyKeyboard to computer, TV broadcast.
Half‑duplexTwo‑way, but not simultaneouslyWalkie‑talkies, RS‑485.
Full‑duplexTwo‑way simultaneouslyEthernet, USB, telephone.

4. Serial vs. parallel transmission

CharacteristicSerialParallel
Bits sent per clock cycle1Multiple (usually 8‑16)
CablingSingle pair (or few pairs)Many wires, bulkier
DistanceLonger (up to kilometres)Short (centimetres‑metres)
Common examplesUSB, RS‑232, EthernetOlder printer ports, internal CPU‑bus

5. Mini‑activity – USB as a transmission interface

  1. Identify the three USB transfer types: Control, Bulk, Isochronous.
  2. Explain why USB is considered a full‑duplex, serial, packet‑switched interface.
  3. Discuss the role of the USB “endpoint” address (shown in hexadecimal, e.g., 0x81 for an IN endpoint).

Computer Hardware – Core Components

1. CPU architecture (simplified)

Block diagram of a basic CPU showing the Control Unit (CU), Arithmetic‑Logic Unit (ALU), registers, and system bus.
  • Control Unit (CU) – fetches, decodes and controls execution of instructions.
  • Arithmetic‑Logic Unit (ALU) – performs arithmetic and logical operations on binary data.
  • Registers – small, fast storage locations (e.g., accumulator, program counter) that hold binary values, often displayed in hexadecimal during debugging.
  • System bus – carries data, addresses and control signals between CPU, memory and peripherals.

2. Network Interface Card (NIC) and MAC address

A NIC provides the hardware link to a network. Each NIC has a unique 48‑bit Media Access Control (MAC) address, usually written in hexadecimal:

Example: 00:1A:2B:3C:4D:5E

The MAC address is used for link‑layer addressing on Ethernet and Wi‑Fi.

3. IP addressing – IPv4 vs. IPv6

FeatureIPv4IPv6
Length32 bits (4 octets)128 bits (16 octets)
NotationDecimal dotted‑quad (e.g., 192.168.0.1)Hexadecimal groups (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334)
Number of addresses≈ 4.3 × 10⁹≈ 3.4 × 10³⁸
Header size20 bytes (minimum)40 bytes (fixed)

4. Primary vs. secondary storage

AspectPrimary (volatile)Secondary (non‑volatile)
Typical devicesRAM (DRAM, SRAM)HDD, SSD, optical discs, USB flash drives
SpeedNanoseconds‑microsecondsMilliseconds (HDD) to microseconds (SSD)
Power dependenceData lost when power is removedData retained without power
Typical capacity (2025)4 GB – 64 GB500 GB – 8 TB (HDD) / 256 GB – 4 TB (SSD)

Key Take‑aways

  • One hex digit = four binary bits (a nibble); this makes hex a concise representation of binary data.
  • All required conversions (binary ↔ decimal, decimal ↔ hex, binary ↔ hex) are systematic and reversible.
  • Understanding overflow, logical shifts and two’s‑complement is essential for working with memory addresses, machine code and signed arithmetic.
  • Hexadecimal links naturally to other data‑representation topics:
    • Text – ASCII/Unicode code points are given in hex.
    • Images – colour values are three hex bytes (R,G,B).
    • Sound – sample values are binary numbers that can be examined in hex.
  • Data transmission concepts (packet structure, switching, transmission modes) and core hardware components (CPU, NIC, storage) complete the IGCSE 0478 syllabus requirements.

Create an account or Login to take a Quiz

49 views
0 improvement suggestions

Log in to suggest improvements to this note.