Number Systems, Text, Sound, Images & Compression
Based on Cambridge O Level Computer Science 2210 Syllabus (2026-2028)
1. Introduction to Number Systems
Why Do Computers Use Binary?
Computers use binary because their internal components (transistors) operate in two states:
- ON (1) – electricity flowing
- OFF (0) – no electricity
All forms of data (text, images, sound) must be converted to binary to be processed by a computer.
The Three Main Number Systems
| Number System | Base | Digits Used | Used By |
|---|---|---|---|
| Binary | 2 | 0, 1 | Computers |
| Denary (Decimal) | 10 | 0–9 | Humans |
| Hexadecimal | 16 | 0–9, A–F | Programmers |
Key Terms:
- Bit: A single binary digit (0 or 1)
- Nibble: 4 bits
- Byte: 8 bits
2. Binary (Base-2)
Understanding Binary
Binary is a base-2 number system. Each digit represents a power of 2, starting from the right (position 0).
Place Values in Binary (8-bit)
| Bit Position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Power of 2 | 2⁷ | 2⁶ | 2⁵ | 2⁴ | 2³ | 2² | 2¹ | 2⁰ |
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Binary to Denary Conversion
Method: Multiply each binary digit by its place value and add the results.
Example 1: Convert 1011 to denary
| Bit Position | 3 | 2 | 1 | 0 |
|---|---|---|---|---|
| Binary Digit | 1 | 0 | 1 | 1 |
| Calculation | 1×2³ | 0×2² | 1×2¹ | 1×2⁰ |
| Value | 8 | 0 | 2 | 1 |
Total = 8 + 0 + 2 + 1 = 11
Example 2: Convert 11010110 to denary (8-bit)
| Position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Binary | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 0 |
| Value | 128 | 64 | 0 | 16 | 0 | 4 | 2 | 0 |
Total = 128 + 64 + 16 + 4 + 2 = 214
3. Denary (Base-10)
Denary to Binary Conversion
Method 1: Division by 2 (Repeated)
- Divide the number by 2 repeatedly
- Record the remainder (0 or 1)
- Read remainders from bottom to top (last to first)
Example 1: Convert 13 to binary
| Division | Quotient | Remainder |
|---|---|---|
| 13 ÷ 2 | 6 | 1 (LSB) |
| 6 ÷ 2 | 3 | 0 |
| 3 ÷ 2 | 1 | 1 |
| 1 ÷ 2 | 0 | 1 (MSB) |
Binary = 1101 (Read from bottom up: 1,1,0,1)
Example 2: Convert 214 to binary
| Division | Quotient | Remainder |
|---|---|---|
| 214 ÷ 2 | 107 | 0 |
| 107 ÷ 2 | 53 | 1 |
| 53 ÷ 2 | 26 | 1 |
| 26 ÷ 2 | 13 | 0 |
| 13 ÷ 2 | 6 | 1 |
| 6 ÷ 2 | 3 | 0 |
| 3 ÷ 2 | 1 | 1 |
| 1 ÷ 2 | 0 | 1 |
Binary = 11010110 (8 bits)
Method 2: Subtraction Method
- Find the largest power of 2 ≤ the number
- Subtract it and put 1 in that position
- Repeat with remainder
For 13:
- Largest power ≤ 13 is 8 (2³) → put 1 in position 3, remainder = 5
- Largest power ≤ 5 is 4 (2²) → put 1 in position 2, remainder = 1
- Largest power ≤ 1 is 1 (2⁰) → put 1 in position 0, remainder = 0
- Positions 1 gets 0
- Result: 1,1,0,1 → 1101
4. Hexadecimal (Base-16)
Understanding Hexadecimal
Hexadecimal is base-16, using digits 0-9 and letters A-F.
| Denary | 0-9 | 10 | 11 | 12 | 13 | 14 | 15 |
|---|---|---|---|---|---|---|---|
| Hex | 0-9 | A | B | C | D | E | F |
Why Do Programmers Use Hexadecimal?
- Compact Representation: Much shorter than binary
- Binary:
1101001110101101(16 digits) - Hex:
D3AD(4 digits)
- Easy to Read: Humans find hex easier to understand
- Easier to Program
- Easier to debug
- Direct Binary Mapping: 1 hex digit = exactly 4 bits (nibble)
- Common Uses in Computer Science:
- Memory addresses (e.g.,
0xFF5733) - Colour codes in web design (e.g.,
#FF5733) - MAC addresses
- Assembly language programming
- Debugging and low-level systems
Denary to Hexadecimal Conversion
Method: Repeated division by 16, recording remainders.
Example 1: Convert 47 to hexadecimal
| Division | Quotient | Remainder |
|---|---|---|
| 47 ÷ 16 | 2 | 15 → F (LSB) |
| 2 ÷ 16 | 0 | 2 → 2 (MSB) |
Hexadecimal = 2F
Example 2: Convert 214 to hexadecimal
| Division | Quotient | Remainder |
|---|---|---|
| 214 ÷ 16 | 13 | 6 → 6 |
| 13 ÷ 16 | 0 | 13 → D |
Hexadecimal = D6
Hexadecimal to Denary Conversion
Method: Multiply each digit by its place value (16ⁿ) and add.
Example 1: Convert 2F to denary
| Digit | Position | Value | Calculation |
|---|---|---|---|
| 2 | 16¹ | 2 | 2 × 16 = 32 |
| F (15) | 16⁰ | 15 | 15 × 1 = 15 |
Total = 32 + 15 = 47
Example 2: Convert D6 to denary
| Digit | Position | Value | Calculation |
|---|---|---|---|
| D (13) | 16¹ | 13 | 13 × 16 = 208 |
| 6 | 16⁰ | 6 | 6 × 1 = 6 |
Total = 208 + 6 = 214
Binary to Hexadecimal Conversion
Method: Split binary into groups of 4 bits (nibbles) from the right, then convert each group.
Example 1: Convert 11010110 to hexadecimal
Binary: 1101 0110
Groups: [1101] [0110]
Convert: D 6
Hexadecimal = D6
Example 2: Convert 1011101011 to hexadecimal (10 bits)
- Add leading zeros to make complete nibbles:
0010 1110 1011 - Groups:
0010(2),1110(14→E),1011(11→B) - Hexadecimal = 2EB
Hexadecimal to Binary Conversion
Method: Convert each hex digit to its 4-bit binary equivalent.
Example 1: Convert 3F to binary
3 → 0011
F → 1111
Result: 00111111
Example 2: Convert A7 to binary
A (10) → 1010
7 → 0111
Result: 10100111
Quick Reference Table
| Denary | Binary (4-bit) | Hex |
|---|---|---|
| 0 | 0000 | 0 |
| 1 | 0001 | 1 |
| 2 | 0010 | 2 |
| 3 | 0011 | 3 |
| 4 | 0100 | 4 |
| 5 | 0101 | 5 |
| 6 | 0110 | 6 |
| 7 | 0111 | 7 |
| 8 | 1000 | 8 |
| 9 | 1001 | 9 |
| 10 | 1010 | A |
| 11 | 1011 | B |
| 12 | 1100 | C |
| 13 | 1101 | D |
| 14 | 1110 | E |
| 15 | 1111 | F |
5. Binary Addition & Overflow
Adding Two 8-bit Binary Integers
Rules of Binary Addition:
- 0 + 0 = 0 (carry 0)
- 0 + 1 = 1 (carry 0)
- 1 + 0 = 1 (carry 0)
- 1 + 1 = 0 (carry 1)
- 1 + 1 + 1 = 1 (carry 1)
Example 1: Add 00110101 (53) and 00011010 (26)
00110101
+ 00011010
---------
01001111 (79)
Example 2: Add 01100101 (101) and 00111010 (58)
01100101
+ 00111010
---------
10011111 (159)
Understanding Overflow
What is Overflow?
- Overflow occurs when the result of a calculation is too large to fit in the available number of bits
- For 8-bit registers, the maximum value is 255 (11111111)
- If the result exceeds 255, an overflow error occurs
Why Does Overflow Happen?
- Computers have a predefined limit (e.g., 8-bit, 16-bit registers)
- When a value outside this limit needs to be stored, the computer cannot represent it correctly
Example of Overflow:
Add 11001000 (200) and 00111000 (56)
11001000
+ 00111000
---------
100000000 (256 - needs 9 bits!)
In an 8-bit register, we would only keep the last 8 bits: 00000000 (0)
This is incorrect! The actual answer should be 256.
Detecting Overflow:
- In 8-bit addition, overflow occurs when there is a carry into the 9th bit
- The result would require more than 8 bits to represent correctly
6. Logical Binary Shifts
What is a Logical Binary Shift?
A logical binary shift moves all bits in a binary number left or right by a specified number of positions.
Key Rules:
- Bits shifted from the end are lost (discarded)
- Zeros are shifted in at the opposite end
- Multiple shifts can be performed
Logical Left Shift
Effect: Each left shift multiplies the number by 2
Example 1: Left shift 00001101 (13) by 1 position
Original: 00001101 (13)
Left shift 1: 00011010 (26)
13 × 2 = 26 ✓
Example 2: Left shift 00001101 (13) by 2 positions
Original: 00001101 (13)
Left shift 2: 00110100 (52)
13 × 4 = 52 ✓
Example 3: Left shift with loss of significant bits
Original: 11010011 (211)
Left shift 1: 10100110 (166 - lost the leading 1)
Note: The most significant bit (MSB) was lost, changing the value significantly.
Logical Right Shift
Effect: Each right shift divides the number by 2 (integer division, remainder lost)
Example 1: Right shift 00001101 (13) by 1 position
Original: 00001101 (13)
Right shift 1: 00000110 (6)
13 ÷ 2 = 6.5 → integer division gives 6 ✓
Example 2: Right shift 00001101 (13) by 2 positions
Original: 00001101 (13)
Right shift 2: 00000011 (3)
13 ÷ 4 = 3.25 → integer division gives 3 ✓
Example 3: Right shift with loss of bits
Original: 00110101 (53)
Right shift 3: 00000110 (6 - lost the last 3 bits)
53 ÷ 8 = 6.625 → integer division gives 6 ✓
Summary of Effects
| Shift Type | Direction | Mathematical Effect | Bits Lost |
|---|---|---|---|
| Logical Left | ← | Multiply by 2ⁿ | Most significant bits |
| Logical Right | → | Divide by 2ⁿ | Least significant bits |
7. Two’s Complement (Signed Binary)
Why Two’s Complement?
So far, we’ve only represented positive binary numbers. Two’s complement allows us to represent both positive and negative integers in binary.
Range of Two’s Complement 8-bit Numbers
- Minimum: -128 (10000000)
- Maximum: +127 (01111111)
- Total range: -128 to +127 (256 values)
Representing Positive Numbers
Positive numbers in two’s complement are represented exactly the same as normal binary, but the most significant bit (MSB) must be 0.
Example: +13 in two’s complement
- Binary of 13:
00001101(MSB is 0, so it’s positive)
Representing Negative Numbers
Method 1: Convert from Positive to Negative
Steps:
- Write the positive number in binary
- Invert all bits (0→1, 1→0)
- Add 1 to the result
Example 1: Find two’s complement of -13
Step 1: +13 in binary = 00001101
Step 2: Invert bits = 11110010
Step 3: Add 1 = 11110011
Therefore, -13 in two’s complement = 11110011
Example 2: Find two’s complement of -42
Step 1: +42 in binary = 00101010
Step 2: Invert bits = 11010101
Step 3: Add 1 = 11010110
Therefore, -42 in two’s complement = 11010110
Method 2: Convert from Negative to Positive (Reverse Process)
Steps to find the value of a negative two’s complement number:
- Invert all bits
- Add 1
- Convert to denary and add negative sign
Example: What is 11110011 in denary?
Step 1: Invert bits = 00001100
Step 2: Add 1 = 00001101
Step 3: Convert to denary = 13, so value = -13
Two’s Complement Conversion Table
| Denary | Two’s Complement |
|---|---|
| +127 | 01111111 |
| +1 | 00000001 |
| 0 | 00000000 |
| -1 | 11111111 |
| -2 | 11111110 |
| -128 | 10000000 |
Recognizing Positive vs Negative
- MSB = 0 → Positive number (or zero)
- MSB = 1 → Negative number
8. Text Representation
Why Convert Text to Binary?
Computers can only process binary, so all text characters must be converted to binary codes.
Character Sets
A character set is a table that maps each character to a unique binary code.
ASCII (American Standard Code for Information Interchange)
- Uses 7 or 8 bits per character
- Can represent 128 or 256 characters
- Includes:
- Uppercase letters (A-Z)
- Lowercase letters (a-z)
- Digits (0-9)
- Punctuation marks
- Control characters (space, enter, tab)
Example ASCII values:
- ‘A’ = 65 (binary
01000001) - ‘a’ = 97 (binary
01100001) - ‘0’ = 48 (binary
00110000) - Space = 32 (binary
00100000)
Unicode
- Uses more bits per character (usually 16 or 32)
- Can represent over 1 million characters
- Includes characters from:
- All world languages
- Emojis 😊
- Special symbols (©, ®, ∞)
Why Unicode?
- ASCII only covers English and basic symbols
- Unicode allows for international text representation
- Different languages, emojis, and special symbols can be represented
Comparison:
| Feature | ASCII | Unicode |
|---|---|---|
| Bits per character | 7-8 | 16-32 |
| Maximum characters | 256 | Over 1 million |
| Language support | English only | All languages |
| Emoji support | No | Yes |
| File size | Smaller | Larger |
9. Sound Representation
How Sound is Stored in Binary
Sound waves are analogue (continuous). To store them digitally, they must be converted to binary through a process called sampling.
The Sampling Process
- Sample – Take measurements of the sound wave at regular intervals
- Quantize – Convert each measurement to a binary number
- Store – Save the binary values
Sample Rate
- Definition: The number of samples taken per second
- Unit: Hertz (Hz) or kilohertz (kHz)
- Example: 44.1 kHz = 44,100 samples per second
Effect of Higher Sample Rate:
- ✅ More accurate representation of the original sound
- ✅ Better quality recording
- ❌ Larger file size
- ❌ More processing power needed
Sample Resolution (Bit Depth)
- Definition: The number of bits used to store each sample
- Example: 16-bit resolution = each sample stored as a 16-bit number
Effect of Higher Sample Resolution:
- ✅ More precise measurements (more possible values)
- ✅ Better dynamic range (quieter to louder sounds)
- ✅ Better quality recording
- ❌ Larger file size
Relationship Between Sample Rate, Resolution and Quality
| Sample Rate | Resolution | Quality | File Size |
|---|---|---|---|
| Low (8 kHz) | Low (8-bit) | Poor (like telephone) | Small |
| Medium (22 kHz) | Medium (16-bit) | Good (FM radio) | Medium |
| High (44.1 kHz) | High (16-bit) | Excellent (CD quality) | Large |
| Very High (96 kHz) | High (24-bit) | Studio quality | Very Large |
10. Image Representation
How Images are Stored in Binary
Images are stored as a grid of tiny squares called pixels (picture elements).
Resolution
- Definition: The number of pixels in an image
- Expression: Width × Height
- Example: 1920 × 1080 = 2,073,600 pixels (about 2 megapixels)
Effect of Higher Resolution:
- ✅ More detail in the image
- ✅ Sharper image
- ❌ Larger file size
- ❌ More processing power needed
Colour Depth
- Definition: The number of bits used to represent each pixel’s colour
- Also called: Bit depth
- Formula: Number of colours = 2^colour depth
Common Colour Depths:
| Colour Depth | Number of Colours | Use Case |
|---|---|---|
| 1-bit | 2 (black and white) | Simple graphics |
| 4-bit | 16 | Early computer graphics |
| 8-bit | 256 | GIF images |
| 16-bit | 65,536 | Medium quality |
| 24-bit | 16.7 million | True colour (photos) |
| 32-bit | 4.3 billion | High-end graphics (+alpha channel) |
Effect of Higher Colour Depth:
- ✅ More accurate colours
- ✅ Smoother gradients
- ❌ Larger file size
Relationship Between Resolution, Colour Depth and Quality
| Resolution | Colour Depth | Quality | File Size |
|---|---|---|---|
| Low (640×480) | Low (8-bit) | Blocky, limited colours | Small |
| Medium (1280×720) | Medium (16-bit) | Good for web | Medium |
| High (1920×1080) | High (24-bit) | Photo quality | Large |
| Very High (4K) | High (24-bit) | Professional | Very Large |
11. Data Storage Measurement
Units of Storage
Computers measure data storage in powers of 2 (based on binary). The prefix “kibi” means 1024, not 1000.
| Unit | Abbreviation | Size | Approximate |
|---|---|---|---|
| Bit | b | Smallest unit | 1 or 0 |
| Nibble | – | 4 bits | Half a byte |
| Byte | B | 8 bits | 1 character |
| Kibibyte | KiB | 1024 bytes | 1024 characters |
| Mebibyte | MiB | 1024 KiB | ~1 million characters |
| Gibibyte | GiB | 1024 MiB | ~1 billion characters |
| Tebibyte | TiB | 1024 GiB | ~1 trillion characters |
| Pebibyte | PiB | 1024 TiB | ~1 quadrillion characters |
| Exbibyte | EiB | 1024 PiB | ~1 quintillion characters |
Conversion Rules
To convert from larger to smaller: Multiply by 1024
Example: 2 MiB to KiB = 2 × 1024 = 2048 KiB
To convert from smaller to larger: Divide by 1024
Example: 4096 KiB to MiB = 4096 ÷ 1024 = 4 MiB
Important Notes
- In computer science (for storage), 1 KiB = 1024 bytes (not 1000)
- For data transmission speeds, sometimes 1000 is used (kbps = kilobits per second)
- Always use 1024 for storage calculations unless the question specifies otherwise
12. File Size Calculations
Image File Size Formula
Formula:
File Size (bits) = Width × Height × Colour Depth
File Size (bytes) = (Width × Height × Colour Depth) ÷ 8
Example 1: Calculate file size of a 1920 × 1080 image with 24-bit colour
Size in bits = 1920 × 1080 × 24
= 2,073,600 × 24
= 49,766,400 bits
Size in bytes = 49,766,400 ÷ 8
= 6,220,800 bytes
Size in KiB = 6,220,800 ÷ 1024 = 6,075 KiB
Size in MiB = 6,075 ÷ 1024 = 5.93 MiB
Example 2: Calculate file size of a 800 × 600 image with 8-bit colour
Size in bits = 800 × 600 × 8
= 480,000 × 8
= 3,840,000 bits
Size in bytes = 3,840,000 ÷ 8 = 480,000 bytes
Size in KiB = 480,000 ÷ 1024 = 468.75 KiB
Sound File Size Formula
Formula:
File Size (bits) = Sample Rate × Sample Resolution × Channels × Duration (seconds)
File Size (bytes) = (Sample Rate × Sample Resolution × Channels × Duration) ÷ 8
Note: Stereo sound has 2 channels, mono has 1 channel.
Example 1: Calculate file size of a 60-second stereo recording
- Sample Rate: 44,100 Hz
- Sample Resolution: 16 bits
- Channels: 2 (stereo)
- Duration: 60 seconds
Size in bits = 44,100 × 16 × 2 × 60
= 44,100 × 16 = 705,600
= 705,600 × 2 = 1,411,200
= 1,411,200 × 60 = 84,672,000 bits
Size in bytes = 84,672,000 ÷ 8 = 10,584,000 bytes
Size in KiB = 10,584,000 ÷ 1024 = 10,335.94 KiB
Size in MiB = 10,335.94 ÷ 1024 = 10.09 MiB
Example 2: 3-minute mono recording at 22,050 Hz, 8-bit
Duration = 3 × 60 = 180 seconds
Size in bits = 22,050 × 8 × 1 × 180
= 22,050 × 8 = 176,400
= 176,400 × 180 = 31,752,000 bits
Size in bytes = 31,752,000 ÷ 8 = 3,969,000 bytes
Size in KiB = 3,969,000 ÷ 1024 = 3,876.95 KiB
Size in MiB = 3,876.95 ÷ 1024 = 3.79 MiB
Factors Affecting File Size
Images:
- Higher resolution → larger file
- Higher colour depth → larger file
- Compression → smaller file
Sound:
- Higher sample rate → larger file
- Higher sample resolution → larger file
- More channels (stereo vs mono) → larger file
- Longer duration → larger file
13. Data Compression
What is Compression?
Compression is the process of reducing the number of bits needed to store or transmit data.
Why Do We Need Compression?
- Save storage space – Store more files on devices
- Reduce transfer time – Files upload/download faster
- Less bandwidth required – Important for streaming and websites
- Optimize performance – Applications run smoother
Two Main Types of Compression
| Type | Data Loss | Use Cases |
|---|---|---|
| Lossless | None | Text, code, PNG images |
| Lossy | Some data discarded | Photos, music, video |
Lossless Compression
Characteristics:
- Original data can be perfectly reconstructed
- No data is permanently removed
- Smaller reduction in file size (typically 2:1 to 3:1)
Common Techniques:
1. Run-Length Encoding (RLE)
Replaces repeated characters with a count and the character.
Example:
Original: AAAABBBCCCCDD
Compressed: 4A3B4C2D
2. Huffman Coding
- Frequently used characters get shorter binary codes
- Rarely used characters get longer binary codes
- Variable-length coding
File Formats using Lossless Compression:
- PNG (images)
- GIF (images)
- FLAC (audio)
- ZIP (archives)
Lossy Compression
Characteristics:
- Original data cannot be perfectly reconstructed
- Some data is permanently removed
- Much larger reduction in file size (10:1 or more)
- Acceptable when perfect accuracy isn’t needed
Common Techniques:
For Images (JPEG):
- Removes fine details the human eye can’t easily see
- Reduces colour accuracy in some areas
- Blends similar colours together
For Audio (MP3):
- Removes frequencies humans can’t hear well
- Simplifies complex sound patterns
- Reduces stereo separation
For Video (MP4):
- Drops unnecessary frames
- Compresses static backgrounds
- Reduces colour information
File Formats using Lossy Compression:
- JPEG (images)
- MP3 (audio)
- MP4, AVI (video)
Comparison: Lossy vs Lossless
| Feature | Lossless | Lossy |
|---|---|---|
| Data recovery | Perfect | Approximate |
| File size reduction | Moderate | Significant |
| Reversible | Yes | No |
| Best for | Text, code, diagrams | Photos, music, video |
| Examples | PNG, FLAC, ZIP | JPEG, MP3, MP4 |
Compression Summary
Original File (10 MB)
↓
[Compression]
↓
Lossless (5 MB) Lossy (2 MB)
↓ ↓
Perfect restore Approximate restore
↓ ↓
Text, code Photos, music
14. Summary & Key Takeaways
Number Systems
| System | Base | Purpose |
|---|---|---|
| Binary | 2 | Computer processing |
| Denary | 10 | Human everyday use |
| Hexadecimal | 16 | Programmer shorthand |
Binary Operations
- Addition: Follow binary addition rules; overflow when result > 255 (8-bit)
- Left shift: Multiply by 2ⁿ
- Right shift: Divide by 2ⁿ (integer division)
- Two’s complement: Represents negative numbers; MSB=0 for positive, MSB=1 for negative
Data Representation
| Data Type | Representation Method | Quality Factors |
|---|---|---|
| Text | Character sets (ASCII, Unicode) | More bits = more characters |
| Sound | Sampling | Sample rate, sample resolution |
| Images | Pixels | Resolution, colour depth |
File Size Formulas
Images: Width × Height × Colour Depth (bits)
Sound: Sample Rate × Sample Resolution × Channels × Duration (seconds)
Storage Units (using 1024)
1 Byte = 8 bits
1 KiB = 1024 bytes
1 MiB = 1024 KiB
1 GiB = 1024 MiB
1 TiB = 1024 GiB
Compression
- Lossless: No data lost (RLE, Huffman)
- Lossy: Some data permanently removed (JPEG, MP3)
- Purpose: Save space, reduce transfer time, less bandwidth
15. Practice Questions
Section A: Number System Conversions
- Convert the following binary numbers to denary:
a) 1011
b) 110101
c) 11111111 - Convert the following denary numbers to binary (8-bit):
a) 25
b) 128
c) 255 - Convert the following hexadecimal to denary:
a) 1A
b) FF
c) 2C - Convert the following denary to hexadecimal:
a) 30
b) 100
c) 255 - Convert between binary and hexadecimal:
a) 10110110 to hex
b) 3F to binary
c) A7 to binary
Section B: Binary Addition & Overflow
- Add the following 8-bit binary numbers:
a) 00110101 + 00101010
b) 01101100 + 00110101
c) 11001010 + 10110101 - Identify which of the additions above cause overflow. Explain why.
Section C: Binary Shifts
- Perform a logical left shift by 2 on
00001101. What is the result in denary? - Perform a logical right shift by 3 on
00110010. What is the result in denary? - A binary number
10110011is left shifted by 1. Which bits are lost and what is the effect on the value?
Section D: Two’s Complement
- Convert the following to two’s complement 8-bit:
a) +25
b) -25
c) -128 - What denary values do these two’s complement numbers represent?
a) 11110000
b) 00001111
c) 10000000
Section E: Text, Sound & Images
- Explain the difference between ASCII and Unicode. Give an advantage of each.
- A sound file has a sample rate of 44.1 kHz and 16-bit resolution. Calculate the file size for a 3-minute stereo recording.
- An image is 1280 × 720 pixels with 24-bit colour depth. Calculate its file size in MiB.
- Explain how increasing the sample rate affects:
a) Sound quality
b) File size
Section F: Data Storage & Compression
- Convert:
a) 5 MiB to KiB
b) 2048 KiB to MiB
c) 2 GiB to bytes - Explain the difference between lossy and lossless compression. Give an example of when each would be used.
- Use Run-Length Encoding to compress:
AAABBBBBCCCCCDD - Explain why hexadecimal is used in computer science instead of binary.
Answers to selected questions:
1a) 11
1b) 53
1c) 255
2a) 00011001
2b) 10000000
2c) 11111111
3a) 26
3b) 255
3c) 44
4a) 1E
4b) 64
4c) FF
5a) D6
5b) 00111111
5c) 10100111
6c) 11001010 + 10110101 = 1 01111111 → overflow!
8) 00110100 (52)
9) 00000110 (6)
14) 44,100 × 16 × 2 × 180 = 254,016,000 bits = 31,752,000 bytes = 31,008 KiB = 30.28 MiB
15) 1280 × 720 × 24 = 22,118,400 bits = 2,764,800 bytes = 2,700 KiB = 2.64 MiB
17a) 5 × 1024 = 5120 KiB
17b) 2048 ÷ 1024 = 2 MiB
17c) 2 × 1024 × 1024 × 1024 = 2,147,483,648 bytes
