Chapter 1 – Data Representation (IGCSE Notes)
1.1 Data and Information
Computer: An electronic device that receives data as input, processes it, stores it, and
produces output as information.
Data: Raw facts and figures, unprocessed and without context.
Example: 65, "John", 101101, True.
Information: Processed data that carries meaning.
Example: "John scored 65 marks in a test."
Why Binary? Computers contain millions of tiny switches (transistors). Each switch can
only be ON (1) or OFF (0). That’s why all data inside a computer is represented in binary
numbers (base 2).
1.2 Number Systems
Decimal (Base 10)
• Digits: 0–9
• Our everyday system.
• Example: 275 = 2×10² + 7×10¹ + 5×10⁰.
Binary (Base 2)
• Digits: 0 and 1 only.
• Each digit = bit.
• Example: (1011)₂ = 11₁₀.
Hexadecimal (Base 16)
• Symbols: 0–9 and A–F (A=10 … F=15).
• Easier to read/write than long binary strings.
• Example: (2F)₁₆ = 47₁₀.
Applications of Hexadecimal (Daily Life)
Hexadecimal Number System (Long Definition):
The hexadecimal system is a base-16 number system. It uses the digits 0–9 and the letters
A–F (where A = 10, B = 11, … F = 15 in decimal).
• It is widely used in computing because it is shorter and easier to read than binary,
while still mapping directly to binary (1 hex digit = 4 binary bits).
(a) Error Codes
Definition: An error code is a numerical or alphanumerical identifier given by software
or hardware to indicate a specific fault or problem.
Use: Hexadecimal is used for error codes because it provides a compact way to represent
binary data. It helps programmers quickly identify errors during debugging.
Example: The error code 0x404 means “Page Not Found” in web browsers.
(b) MAC Address (Media Access Control Address)
Definition: A MAC address is a unique identifier assigned to the network interface card
(NIC) of a device. It consists of 48 bits (or sometimes 64 bits), usually written in
hexadecimal.
Use: Hexadecimal notation makes long binary MAC addresses shorter and easier to read.
Example: A MAC address written in hexadecimal looks like 00:1A:C2:7B:00:47.
(c) HTML / CSS Colour Codes
Definition: A colour code is a numerical representation of colours based on the RGB
(Red, Green, Blue) model. In web design, colours are represented using hexadecimal
numbers.
Use: Each pair of hexadecimal digits shows the intensity of Red, Green, and Blue (from 00 =
0 to FF = 255).
Example: The colour code #FF5733 means Red = 255, Green = 87, Blue = 51.
(d) Assembly Language / Machine Code
Definition: Assembly language is a low-level programming language that uses symbols
and codes to represent machine instructions. These instructions are ultimately binary but are
often represented in hexadecimal for simplicity.
Use: Hexadecimal makes long binary instructions more compact and easier for programmers
to understand.
Example: The instruction B800 in hexadecimal corresponds to a CPU command.
Area Definition How Hex is Used Example
Identifier for Compact, easy-to-
Error Codes faults/problems in software read debugging 0x404 → Not Found
or hardware codes
Area Definition How Hex is Used Example
Unique network identifier of Written in hex pairs
MAC Addresses 00:1A:C2:7B:00:47
a device’s NIC instead of binary
Representation of colours in Each pair = intensity #FF5733 (orange
HTML Colours
RGB model of Red, Green, Blue shade)
Hex replaces long
Assembly/Machine Low-level CPU instructions
binary strings
1.3 Conversions
• Binary → Decimal: Multiply each bit by 2ⁿ and add.
• Decimal → Binary: Divide by 2 repeatedly, record remainders.
• Binary ↔ Hexadecimal: Group bits into nibbles (4 bits).
Examples:
• (101101)₂ → 45₁₀
• (158)₁₀ → (10011110)₂
• (9A)₁₆ → (10011010)₂
1.4 Binary Arithmetic
Rules:
• 0+0=0
• 0+1=1
• 1+0=1
• 1 + 1 = 10 (carry 1)
Example:
(1011)₂ + (1110)₂ = (11001)₂
Overflow: Happens when result needs more bits than available.
1.5 Units of Storage
• Bit (Binary Digit): Smallest unit of data. Can only be 0 or 1.
• Nibble: Group of 4 bits. Example: 1010.
• Byte (B): Group of 8 bits. Example: 10110101.
Larger Units (Binary multiples):
• Kibibyte (KiB): 1 KiB = 1024 bytes
• Mebibyte (MiB): 1 MiB = 1024 KiB
• Gibibyte (GiB): 1 GiB = 1024 MiB
• Tebibyte (TiB): 1 TiB = 1024 GiB
1.6 Representing Text
ASCII (American Standard Code for Information Interchange):
• 7 or 8 bits per character.
• Represents English characters (A=65, B=66, etc.).
Unicode:
• 16 or 32 bits per character.
• Supports all world languages, emojis, and symbols.
1.7 Representing Images
• Images are made up of pixels (small squares).
• Each pixel has a binary value for its colour.
• Colour depth = number of bits per pixel.
o Example: 8-bit → 256 colours.
• Resolution: Number of pixels in width × height.
File Size Formula:
Image Size (bits) = Width × Height × Colour depth
Example:
800×600 pixels, 24-bit colour → 11,520,000 bits ≈ 1.44 MB.
1.8 Representing Sound
• Sound is analogue → must be converted to digital using sampling.
• Sample rate: Number of samples per second (Hz).
• Sample resolution: Bits per sample.
File Size Formula:
File size (bits) = Sample rate × Resolution × Channels × Time
Example:
44.1 kHz, 16-bit, 2 channels, 60s → 84,672,000 bits ≈ 10.1 MB.
1.9 Compression
Lossless Compression
• No data lost.
• File restored exactly.
• Examples: ZIP, PNG.
Lossy Compression
• Some data is permanently removed → smaller files.
• Examples: JPEG (images), MP3 (audio), MPEG (video).
• JPEG: Reduces file size by removing fine detail.
• MP3: Removes inaudible frequencies.
• MPEG: Compresses video by removing redundant frames/sounds.
1.10 Network Addresses
MAC Address (Media Access Control):
• Uniquely identifies a device on a network.
• 48-bit number, written in hex (e.g., 00:1A:C2:7B:00:47).
• Built into network card by manufacturer.
• Used by switches to send data to correct device.
IP Address (Internet Protocol):
• Identifies a device’s location on the network.
• IPv4: 32 bits (e.g., 192.168.0.1).
• IPv6: 128 bits (e.g., 3FFE:1900:4545:0003:0200:F8FF:FE21:67CF).
• Can change when device reconnects.
1.11 Error Checking Methods
When data is transmitted, errors may occur. Methods include:
• Parity Check
o Extra bit added to make total number of 1s even (even parity) or odd (odd
parity).
o Simple but can’t detect all errors.
• Check Digit
o Extra digit added to numbers (like ISBN, barcodes).
o Helps detect input errors.
• ARQ (Automatic Repeat reQuest)
o Data sent with an acknowledgement.
o If error found, receiver requests retransmission.
• Checksums
o Block of data sent with an extra value calculated from data.
o Receiver recalculates and compares.
1.12 Applications of Hexadecimal
Easier for humans than binary.
Used in:
• Memory addresses (e.g., error messages).
• Colour codes in HTML/CSS (e.g., #FF5733).
• MAC addresses.
• Error codes (e.g., 0x404 = Not Found).
1.13 Practice Questions with Answers
Q1. Convert (101101) into decimal.
Answer:
Step 1: Write down the place values of each digit (from right to left):
1 0 1 1 0 11\;0\;1\;1\;0\;1101101 25 24 23 22 21
202^5\;2^4\;2^3\;2^2\;2^1\;2^0252423222120
Step 2: Multiply each digit by its place value:
(1×25)+(0×24)+(1×23)+(1×22)+(0×21)+(1×20)(1 \times 2^5) + (0 \times 2^4) + (1 \times
2^3) + (1 \times 2^2) + (0 \times 2^1) + (1 \times
2^0)(1×25)+(0×24)+(1×23)+(1×22)+(0×21)+(1×20)
Step 3: Calculate values:
32+0+8+4+0+1=4532 + 0 + 8 + 4 + 0 + 1 = 4532+0+8+4+0+1=45
✅ Final Answer: (101101) = (45)
Q2. Convert (275) into binary.
Answer:
Step 1: Divide by 2 repeatedly and record remainders:
• 275 ÷ 2 = 137 remainder 1
• 137 ÷ 2 = 68 remainder 1
• 68 ÷ 2 = 34 remainder 0
• 34 ÷ 2 = 17 remainder 0
• 17 ÷ 2 = 8 remainder 1
• 8 ÷ 2 = 4 remainder 0
• 4 ÷ 2 = 2 remainder 0
• 2 ÷ 2 = 1 remainder 0
• 1 ÷ 2 = 0 remainder 1
Step 2: Read remainders from bottom to top:
100010011100010011100010011
✅ Final Answer: (275) = (100010011)
Q3. Convert (9F) into decimal.
Answer:
Step 1: Expand hexadecimal digits:
• 9=9
• F = 15
Step 2: Apply place values:
(9×161)+(15×160)(9 \times 16^1) + (15 \times 16^0)(9×161)+(15×160)
Step 3: Calculate:
(9×16)+(15×1)=144+15=159(9 \times 16) + (15 \times 1) = 144 + 15 =
159(9×16)+(15×1)=144+15=159
✅ Final Answer: (9F) = (159)
Q4. Perform (1011) + (1110).
Answer:
Step 1: Write numbers in column form:
1011
+ 1110
-------
Step 2: Add bit by bit (right to left):
• 1+0=1
• 1 + 1 = 0 (carry 1)
• 0 + 1 + carry 1 = 0 (carry 1)
• 1 + 1 + carry 1 = 1 (carry 1 left over)
Step 3: Write result with carry:
1011
+ 1110
-------
11001
✅ Final Answer: (11001)
Q5. Calculate size of a 640 × 480, 16-bit image.
Answer:
Step 1: Calculate total pixels:
640×480=307,200 pixels640 \times 480 = 307,200 \text{ pixels}640×480=307,200 pixels
Step 2: Bits needed:
307,200×16=4,915,200 bits307,200 \times 16 = 4,915,200 \text{
bits}307,200×16=4,915,200 bits
Step 3: Convert bits into bytes:
4,915,200÷8=614,400 bytes4,915,200 \div 8 = 614,400 \text{
bytes}4,915,200÷8=614,400 bytes
Step 4: Convert bytes into kibibytes (KiB):
614,400÷1024=600 KiB614,400 \div 1024 = 600 \text{ KiB}614,400÷1024=600 KiB
✅ Final Answer: 600 KiB
Q6. Calculate size of a 2-minute audio file at 44.1 kHz, 16-bit, mono.
Answer:
Step 1: Sampling rate = 44,100 samples/second
Step 2: Bits per second:
44,100×16=705,600 bits/second44,100 \times 16 = 705,600 \text{
bits/second}44,100×16=705,600 bits/second
Step 3: Total seconds in 2 minutes:
2×60=120 seconds2 \times 60 = 120 \text{ seconds}2×60=120 seconds
Step 4: Total bits:
705,600×120=84,672,000 bits705,600 \times 120 = 84,672,000 \text{
bits}705,600×120=84,672,000 bits
Step 5: Convert bits into bytes:
84,672,000÷8=10,584,000 bytes84,672,000 \div 8 = 10,584,000 \text{
bytes}84,672,000÷8=10,584,000 bytes
Step 6: Convert bytes into mebibytes (MiB):
10,584,000÷1,048,576≈10.1 MiB10,584,000 \div 1,048,576 \approx 10.1 \text{
MiB}10,584,000÷1,048,576≈10.1 MiB
✅ Final Answer: 10.1 MiB
Extra Notes (Add-on to Chapter 1 – Data Representation)
Pixels (for Images)
• Pixel (Picture Element): The smallest unit of an image displayed on a screen.
• Each pixel has a colour value stored in binary.
• The quality of an image depends on:
o Resolution (number of pixels in width × height).
o Colour depth (bits per pixel).
• Example: An image with 1920×1080 pixels at 24-bit depth stores millions of colours.
Error Checking Methods
Why needed? Data can be corrupted during transmission or storage. Error-checking ensures
accuracy.
1. Parity Bits
o A bit added to data to make the total number of 1s either even (even parity) or
odd (odd parity).
o Receiver checks parity; mismatch = error detected.
o Example: 1011001 with even parity → add 1 → 10110011.
2. Check Digit
o Extra digit added to numbers (e.g., barcodes, ISBN) to verify correctness.
o Calculated using an algorithm on other digits.
o Example: ISBN 978-0-13-601970 has last digit 0 as a check digit.
3. ARQ (Automatic Repeat Request)
o Uses acknowledgement + timeout.
o If receiver detects error, it requests retransmission.
4. Checksums
o Sender calculates a total (checksum) based on data bits.
o Receiver recalculates; if mismatch → error.
Uses of Hexadecimal
• Easier for humans to read compared to long binary strings.
• Applications:
1. Memory addresses in computer systems.
2. Error codes in software (e.g., "Error 0x3F").
3. MAC addresses of devices.
4. Colour representation in HTML/CSS (e.g., #FF5733).
5. Assembly programming.
Error Codes
• Often written in hexadecimal for compactness.
• Example:
o 0x0000007B → Windows boot error.
o 0xC0000005 → Access violation error.
• Easier for programmers to trace and debug issues.
MAC (Media Access Control) Addresses
• Unique identifier assigned to every device on a network card.
• 48-bit (6 bytes), written in hexadecimal.
• Example: 3A:4F:2B:11:9C:7E.
• Split into:
o First 24 bits = manufacturer ID.
o Last 24 bits = unique device ID.
• Used for:
o Identifying devices in LANs.
o Filtering devices in Wi-Fi routers.
IP Addresses
1. IPv4 (Internet Protocol version 4):
o 32-bit address.
o Written as 4 decimal numbers (0–255) and dotted decimals.
o Example: 192.168.0.1.
o About 4.3 billion addresses (running out).
o Used for identifying devices across the Internet.
2. IPv6 (Internet Protocol version 6):
o 128-bit address.
o Written in hexadecimal.
o Example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334.
o Provides huge number of addresses for modern internet devices.\
o Used for identifying devices across the Internet.
Lossy vs Lossless Compression (with file types)
1. Lossless Compression
o No data is lost. Original file can be perfectly reconstructed.
o Examples:
▪PNG images.
▪ ZIP archives.
▪ Text files.
o Used for: text, spreadsheets, databases, legal docs.
2. Lossy Compression
o Some data removed permanently (usually details humans don’t notice).
o Examples:
▪ JPEG (images).
▪ MP3 (audio).
▪ MP4 (video).
o Used for: multimedia (smaller file sizes).
3. File Formats
o JPEG: Lossy image compression (photos).
o PNG: Lossless image compression (logos, diagrams).
o MP3: Lossy audio compression.
o WAV: Uncompressed audio.
o MPEG/MP4: Compressed video files.
JPEG (Joint Photographic Experts Group)
• Lossy compression for images.
• Removes details the human eye cannot detect.
• Used in: photographs, online images.
• File sizes much smaller than BMP or PNG.
MP3 (MPEG-1 Audio Layer 3)
• Lossy compression for audio.
• Removes sounds outside human hearing range.
• Used in: music, podcasts, portable devices.
MPEG (Moving Picture Experts Group)
• Standards for video and audio compression.
• MPEG-2: DVDs, digital TV.
• MPEG-4 (MP4): Internet video, streaming, mobile devices.