Welcome to Digital Data!

Have you ever wondered how your smartphone stores millions of photos, plays high-definition music, or sends a text message across the world in a split second? The secret is simple: behind the screen, everything is turned into numbers!

In this chapter, we will look at Digital Data. You will discover how computers use simple electrical switches to represent numbers, text, images, and sounds, and how we measure and compress this data. Don't worry if you find maths or technical terms tricky at first — we will break everything down into bite-sized, easy-to-follow steps.


1. Number Systems: Binary, Denary, and Hexadecimal

Why Do Computers Use Binary?

Humans count in Denary (Base \(10\)), using the digits \(0\) through \(9\). We probably do this because we have \(10\) fingers!

Computers, however, do not have fingers — they are made of microscopic electronic switches called transistors. A switch can only be in one of two states:

ON (electricity is flowing) represented by the number \(1\)
OFF (no electricity) represented by the number \(0\)

Because there are only two possibilities, computers count using the Binary number system (Base \(2\)). Every single picture, song, video game, and app is stored as billions of \(0\)s and \(1\)s.

Place Values in Binary (8-bit Byte)

In denary, our columns go up in powers of \(10\) (\(1000\), \(100\), \(10\), \(1\)). In binary, our columns double each time from right to left:

\(128\) | \(64\) | \(32\) | \(16\) | \(8\) | \(4\) | \(2\) | \(1\)

Converting Binary to Denary

To convert a binary number to denary, write out the place value table and add together the values where there is a \(1\).

Example: Convert the binary number \(10010110\) to denary.

• Place \(128\): \(1 \implies 128\)
• Place \(64\): \(0 \implies 0\)
• Place \(32\): \(0 \implies 0\)
• Place \(16\): \(1 \implies 16\)
• Place \(8\): \(0 \implies 0\)
• Place \(4\): \(1 \implies 4\)
• Place \(2\): \(1 \implies 2\)
• Place \(1\): \(0 \implies 0\)

Now add them up: \(128 + 16 + 4 + 2 = 150\).
So, \(10010110\) in binary is \(150\) in denary.

Converting Denary to Binary

To turn a denary number into binary, work from left to right (from \(128\) down to \(1\)). Ask yourself: "Does this column value fit into my remaining number?" If yes, write a \(1\) and subtract that value. If no, write a \(0\).

Example: Convert \(77\) to an 8-bit binary number.

• Does \(128\) fit into \(77\)? No \(\implies 0\)
• Does \(64\) fit into \(77\)? Yes \(\implies 1\) (Remainder: \(77 - 64 = 13\))
• Does \(32\) fit into \(13\)? No \(\implies 0\)
• Does \(16\) fit into \(13\)? No \(\implies 0\)
• Does \(8\) fit into \(13\)? Yes \(\implies 1\) (Remainder: \(13 - 8 = 5\))
• Does \(4\) fit into \(5\)? Yes \(\implies 1\) (Remainder: \(5 - 4 = 1\))
• Does \(2\) fit into \(1\)? No \(\implies 0\)
• Does \(1\) fit into \(1\)? Yes \(\implies 1\) (Remainder: \(1 - 1 = 0\))

Result: \(77\) in binary is \(01001101\).

Binary Addition

Adding binary numbers follows four simple rules:

• \(0 + 0 = 0\)
• \(0 + 1 = 1\)
• \(1 + 1 = 0\) (carry \(1\) to the next column on the left)
• \(1 + 1 + 1 = 1\) (carry \(1\) to the next column on the left)

What is an Overflow Error?
If you add two 8-bit numbers together and the result needs a 9th bit (a value of \(256\) or greater), the computer cannot fit that extra bit in the allocated 8-bit memory space. This is called an overflow error, which causes calculation mistakes or system crashes.

Hexadecimal (Base 16)

Binary strings like \(111100101011\) are long and hard for humans to read. Computer scientists use Hexadecimal (or Hex) as a shorter, human-friendly shorthand.

Hex uses \(16\) distinct symbols:
\(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, \text{A}(10), \text{B}(11), \text{C}(12), \text{D}(13), \text{E}(14), \text{F}(15)\)

Converting 8-bit Binary to Hex:
1. Split the 8-bit binary number into two 4-bit groups (called nibbles).
2. Find the denary value of each nibble (using place values \(8, 4, 2, 1\)).
3. Convert each value to its Hex character.

Example: Convert \(11011010\) to Hex:
• Left nibble: \(1101 \implies 8 + 4 + 1 = 13 \implies \mathbf{D}\)
• Right nibble: \(1010 \implies 8 + 2 = 10 \implies \mathbf{A}\)
• Result: \(\text{DA}\) in Hex.

Why use Hexadecimal?
• It takes up less screen space than binary.
• It is much easier for humans to read, write, and remember.
• It reduces typing mistakes when programmers write colour codes (e.g., \(\#\text{FFFFFF}\) for white) or MAC addresses.

Key Takeaway

Computers run on binary (\(0\) and \(1\)). We use denary (\(0\text{--}9\)) in daily life, and programmers use hexadecimal (\(0\text{--}\text{F}\)) as a readable shorthand for long binary values.


2. Units of Data Storage

Just like we measure weight in grams and kilograms, digital storage has standard units of measurement.

Bit (b): A single binary digit (\(0\) or \(1\)). This is the smallest unit of data.
Nibble: A group of \(4\) bits.
Byte (B): A group of \(8\) bits (can store a single keyboard character, like 'A').
Kilobyte (KB): \(1024\) bytes (or \(1000\) bytes in decimal standard).
Megabyte (MB): \(1024\text{ KB}\) (used for songs and high-res photos).
Gigabyte (GB): \(1024\text{ MB}\) (used for video games and movies).
Terabyte (TB): \(1024\text{ GB}\) (used for computer hard drives).
Petabyte (PB): \(1024\text{ TB}\) (used for huge data centres like Google or Netflix).

Memory Trick to Remember the Order:
"Big Nibbles Bite Kids Making Giant Tasty Pizzas"
(Bit, Nibble, Byte, Kilobyte, Megabyte, Gigabyte, Terabyte, Petabyte)

Common Mistake to Avoid: A lowercase b stands for bit, while an uppercase B stands for Byte. So \(10\text{ Mb}\) is \(10\text{ Megabits}\), but \(10\text{ MB}\) is \(10\text{ Megabytes}\) (\(8\) times larger!).

Key Takeaway

\(8\text{ bits} = 1\text{ byte}\). Each larger unit is \(1024\) times bigger than the previous unit.


3. Data Types

When software collects information, it must assign the correct data type so the computer knows how to process and store it:

Integer: Whole numbers with no decimal point (e.g., \(15\), \(-4\), \(0\)). Used for counting items or ages.
Real / Float: Numbers that contain decimal points (e.g., \(19.99\), \(-3.14\)). Used for prices, weights, or measurements.
Boolean: Can only take one of two values: True or False (e.g., isSubscribed, lightSwitchOn).
Character: A single letter, number, or symbol enclosed in quotes (e.g., 'A', '!', '9').
String: A sequence of multiple characters, text, or words (e.g., "Belfast", "Hello World 123").

Key Takeaway

Choosing the correct data type ensures memory is used efficiently and prevents errors during program execution.


4. Representing Text

How does a computer know that the key you pressed is the letter 'A'? It uses a character set — a lookup table that matches every character to a specific binary number.

ASCII (American Standard Code for Information Interchange)

• Uses \(7\) bits per character (providing \(128\) possible codes) or Extended ASCII which uses \(8\) bits (\(256\) possible codes).
• Covers standard English letters (A-Z, a-z), numbers (\(0\text{--}9\)), punctuation marks, and control symbols (like Enter or Space).
Limitation: \(256\) codes are not enough to represent characters from non-English languages (such as Arabic, Mandarin, or Greek) or emojis.

Unicode

• Uses \(16\) or \(32\) bits per character.
• Can represent over \(1\text{ million}\) unique characters.
• Includes every written human language, mathematical symbols, historical scripts, and modern emojis (\(\unicode{x1F600}\)).
Trade-off: Files take up more storage space compared to plain ASCII because each character requires more bits.

Key Takeaway

ASCII is lightweight but only supports English characters. Unicode uses more bits per character to support all global languages and emojis.


5. Representing Images

Digital pictures are stored as bitmap images. A bitmap is a grid made up of tiny coloured squares called pixels (short for picture elements).

Key Terms for Images

Pixel: The smallest individual element of a digital image.
Resolution: The total number of pixels in an image, usually given as \(\text{width} \times \text{height}\) (e.g., \(1920 \times 1080\)). Higher resolution means clearer images with more detail, but larger file sizes.
Colour Depth: The number of bits used to represent the colour of each individual pixel.
   - \(1\text{-bit depth}\) = \(2^1 = 2\text{ colours}\) (Monochrome: Black and White)
   - \(8\text{-bit depth}\) = \(2^8 = 256\text{ colours}\)
   - \(24\text{-bit True Colour}\) = \(2^{24} \approx 16.7\text{ million colours}\) (provides realistic photo quality)

Calculating File Size for an Image

You can calculate the uncompressed file size of a bitmap image using this formula:

\(\text{File Size (in bits)} = \text{Width (pixels)} \times \text{Height (pixels)} \times \text{Colour Depth (bits)}\)

Example: An image is \(100\text{ pixels}\) wide, \(50\text{ pixels}\) high, with an \(8\text{-bit}\) colour depth.
\(\text{Size} = 100 \times 50 \times 8 = 40000\text{ bits}\).
To convert to Bytes, divide by \(8\): \(40000 \div 8 = 5000\text{ Bytes}\) (approx \(5\text{ KB}\)).

What is Metadata?

Metadata means "data about data". It is extra information saved inside the image file alongside the pixels. Examples include:
• Dimensions (width and height)
• Colour depth and resolution
• Date and time the photo was taken
• Camera settings and GPS location coordinates

Key Takeaway

Image quality and file size increase when you increase resolution (more pixels) or colour depth (more bits per pixel).


6. Representing Sound

Real-world sound is analogue — it travels as a continuous, smooth wave. Computers can only understand binary, so analogue sound must be converted into digital data through a process called sampling.

How Sound is Sampled

An analogue-to-digital converter measures the height (amplitude) of the sound wave at regular time intervals and records that value as a binary number.

Sample Rate: The number of samples taken per second, measured in Hertz (Hz) or Kilohertz (kHz). For CD-quality audio, the standard sample rate is \(44.1\text{ kHz}\) (\(44100\text{ times per second}\)).
Sample Resolution (Bit Depth): The number of bits used to record the amplitude of each sample. A higher bit depth allows a closer, more accurate recording of quiet and loud sounds.

Calculating Sound File Size

\(\text{Sound File Size (bits)} = \text{Sample Rate (Hz)} \times \text{Bit Depth (bits)} \times \text{Duration (seconds)}\)

Increasing the sample rate or bit depth improves audio quality and sounds closer to the original, but results in a larger file size.

Key Takeaway

Sound is converted to digital through sampling. Higher sample rate and bit depth produce better sound fidelity but larger files.


7. Data Compression

Uncompressed media files are often too large to download quickly or store easily. Compression is the process of reducing file size.

Why is Compression Important?

• Files download and stream much faster over the Internet.
• Less network bandwidth is consumed.
• Less storage space is required on hard drives and servers.

Lossy vs. Lossless Compression

1. Lossy Compression:
• Permanently removes data that human ears or eyes are less likely to notice (e.g., very high frequencies in audio or subtle colour shades in photos).
Advantage: Dramatically reduces file size.
Disadvantage: Original quality cannot be restored; some detail is lost forever.
Common File Formats: JPEG (photos), MP3 (audio), MP4 (video).

2. Lossless Compression:
• Reduces file size by finding patterns and encoding data efficiently without deleting any information.
Advantage: Zero loss in quality; the original file can be reconstructed perfectly bit-for-bit.
Disadvantage: File size reduction is not as large as lossy compression.
Common File Formats: PNG (images), ZIP (documents and program files), FLAC (lossless audio).

Think About It: You would never use lossy compression on a text file or program code! If a computer deletes even one semicolon or word, the entire document or program will break.

Key Takeaway

Lossy deletes unnoticeable data for huge file savings (best for streaming/media). Lossless shrinks files without losing any data (essential for software, text, and critical documents).


Quick Review Checklist

Before you move on to past paper questions, check that you can:
• Convert numbers between Denary, Binary, and Hexadecimal.
• Perform simple 8-bit binary addition and spot an overflow error.
• List storage units in order from Bit up to Petabyte.
• Identify appropriate data types for different scenarios.
• Explain the difference between ASCII and Unicode.
• Describe how resolution and colour depth affect image quality and file size.
• Describe how sample rate and bit depth affect sound recordings.
• Contrast lossy and lossless compression with everyday examples.