Data Representation Examples in CS Thinking

Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Data Representation.

This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in CS Thinking.

Concept Recap

The way information—numbers, text, images, and sound—is encoded as binary digits (0s and 1s) inside a computer. Different encoding schemes map real-world data to binary patterns, such as ASCII/Unicode for text, RGB for colors, and sampling for audio.

Turning real-world things (text, images, sound) into numbers a computer can process.

Read the full concept explanation →

How to Use These Examples

  • Read the first worked example with the solution open so the structure is clear.
  • Try the practice problems before revealing each solution.
  • Use the related concepts and background knowledge badges if you feel stuck.

What to Focus On

Core idea: All data in computers is ultimately numbers—representation is the mapping.

Common stuck point: Different representations have trade-offs (quality vs. size).

Sense of Study hint: When learning about data representation, start with the simplest case: how integers map to binary. Then explore how text uses encoding tables (ASCII maps 'A' to 65). Finally, see how complex data like images and sound are broken into numbers that can be stored as binary.

Common Mistakes to Watch For

Before you work through the examples, skim the mistake guide so you know which shortcuts and sign errors to avoid.

Worked Examples

Example 1

easy
A computer stores the character 'A' as the number 65 (ASCII). Explain why computers use numbers to represent characters.

Solution

  1. 1
    Step 1: Computers can only store binary numbers (sequences of 0s and 1s).
  2. 2
    Step 2: To store text, each character is assigned a unique number using an encoding scheme like ASCII (A=65, B=66, etc.).
  3. 3
    Step 3: The binary for 65 is 01000001, which is what the computer actually stores. The encoding scheme maps between human-readable characters and binary.

Answer

Computers only store binary numbers. Characters are represented by assigning each a unique number via an encoding scheme like ASCII.
Character encoding is a fundamental concept in data representation. ASCII uses 7 bits (128 characters), while Unicode extends this to represent characters from all writing systems worldwide.

Example 2

medium
Explain how a computer represents a colour image using binary. What are pixels and colour depth?

Practice Problems

Try these problems on your own first, then open the solution to compare your method.

Example 1

medium
Sound is analogue but computers are digital. Describe how analogue sound is converted to digital form, using the terms 'sample rate' and 'bit depth'.

Example 2

hard
Explain the difference between lossless and lossy compression. Give an example of each and explain when you would choose one over the other.

Background Knowledge

These ideas may be useful before you work through the harder examples.

binarybits bytes