Back to Computer Science Notes

hexadecimal octal

A LevelComputer Science~5 min read

Overview

# Hexadecimal and Octal - Cambridge A-Level Computer Science ## Summary This lesson covers alternative number systems used extensively in computing: hexadecimal (base-16) and octal (base-8). Students learn to convert between binary, denary, hexadecimal and octal systems, understanding that hexadecimal provides a more compact representation of binary data (4 bits per hex digit), making it particularly useful for representing memory addresses, colour codes, and machine code. The topic is essential for A-Level examinations, with typical questions requiring conversions, explaining advantages of hexadecimal over binary, and applying these systems to practical contexts such as MAC addresses, IPv6 addresses, and assembly language debugging. ## Exam Relevance Expect 4-6 mark questions on conversions and 2-3 mark questions explaining why hexadecimal is preferred in specific computing applications.

Core Concepts & Theory

Hexadecimal (base-16) and octal (base-8) are number systems used extensively in computing as shorthand for binary. Understanding these systems is fundamental for A-Level Computer Science.

Hexadecimal System: Uses 16 digits (0-9, A-F where A=10, B=11, C=12, D=13, E=14, F=15). Each hex digit represents exactly 4 binary bits, making conversions efficient. The place values are powers of 16: ..., 16³, 16², 16¹, 16⁰ (4096, 256, 16, 1).

Octal System: Uses 8 digits (0-7). Each octal digit represents exactly 3 binary bits. Place values are powers of 8: ..., 8³, 8², 8¹, 8⁰ (512, 64, 8, 1).

Key Conversion Formulas:

  • Binary to Hex: Group bits in fours from right, convert each group
  • Binary to Octal: Group bits in threes from right, convert each group
  • Denary to Hex/Octal: Use repeated division by 16 or 8, recording remainders

Mnemonic for Hex digits: "All Bad Children Deserve Extra Food" (A=10, B=11, C=12, D=13, E=14, F=15)

Cambridge Definition: Hexadecimal is a base-16 numbering system particularly useful for representing large binary numbers concisely, commonly used in memory addresses, colour codes, and machine code.

Why use these systems? Binary numbers become unwieldy (11010011101 is difficult to read). The hex equivalent (6DD) is far more manageable. Since 16=2⁴ and 8=2³, conversions between binary and hex/octal are straightforward, unlike denary conversions which require complex arithmetic.

Detailed Explanation with Real-World Examples

Real-World Applications demonstrate why hexadecimal and octal remain relevant despite appearing archaic:

1. Memory Addresses: Computer memory locations are expressed in hexadecimal. A typical address like 0x7FFF5C28 is far more readable than its 32-bit binary equivalent. Programmers debugging code constantly reference hex addresses.

2. Colour Codes: Web designers use hex colour codes (#FF5733). Here, FF=255 (red intensity), 57=87 (green), 33=51 (blue). This RGB system makes 16.7 million colours accessible through compact 6-character codes.

3. MAC Addresses: Network cards have unique identifiers like A4:5E:60:E8:3B:9F. Each pair is a hex byte (00-FF), making 48 bits manageable.

4. File Permissions (Octal): Unix/Linux systems use octal for file permissions. The command chmod 755 sets specific read/write/execute permissions, where each digit (7,5,5) represents a 3-bit pattern.

Analogy: Think of hex as shorthand notation for binary, like abbreviations in texting. "LOL" is easier than "laughing out loud", just as "3F" is simpler than "00111111". The meaning stays identical, but communication improves.

Historical Context: Octal was popular in early computing (PDP-8 computers) because word sizes were multiples of 3 bits. Modern systems favour hex due to 8-bit bytes (2 hex digits perfectly represent 1 byte).

Industry Practice: Assembly language programmers and cybersecurity professionals use hex daily when examining memory dumps, analysing malware, or reverse-engineering software.

Worked Examples & Step-by-Step Solutions

**Example 1: Convert binary 101110110011 to hexadecimal** *Solution*: 1. Group from right in fours: **1011 1011 0011** 2. Convert each group: 1011₂=11₁₀=B₁₆, 1011₂=B₁₆, 0011₂=3₁₆ 3. **Answer: BB3₁₆** *Examiner note*: Always group from RIGHT. Adding leading zeros if needed (e.g., 0101) earns marks....

Unlock 3 More Sections

Sign up free to access the complete notes, key concepts, and exam tips for this topic.

No credit card required · Free forever

Key Concepts

  • Hexadecimal (Hex): A base-16 number system using digits 0-9 and letters A-F to represent values 0-15.
  • Octal: A base-8 number system using digits 0-7.
  • Base (Radix): The number of unique digits, including zero, used to represent numbers in a positional numeral system.
  • Binary: A base-2 number system using only digits 0 and 1.
  • +3 more (sign up to view)

Exam Tips

  • **Memorise Hex Equivalents:** Be able to quickly recall the decimal and 4-bit binary equivalents for hex digits A-F (e.g., F = 15 = 1111). This speeds up conversions significantly.
  • **Practice Grouping:** For binary to hex/octal conversions, always group from the **right-hand side** first and pad with leading zeros on the left if necessary. Errors often occur when grouping from the left.
  • +1 more tips (sign up)

AI Tutor

Get instant AI-powered explanations for any concept in this topic.

Still Struggling?

Get 1-on-1 help from an expert A Level tutor.

More Computer Science Notes

Ask Aria anything!

Your AI academic advisor