DATA REPRESENTATION
Data representation describes how computers store and process information such as numbers,
text, sound, and images. This teaching note prepares students to answer all exam-style questions
related to number systems, ASCII, binary addition, two’s complement, overflow, and sound
representation without using the original exam questions.
1. Introduction to Data Representation
Computers cannot understand letters or symbols directly.
They convert everything into numbers, specifically binary (base 2) values.
We (humans) use decimal (base 10), so when interacting with computers, we often use
intermediate systems such as hexadecimal (base 16) because it is shorter and easier to read than
binary.
Examples of data stored numerically:
Text → stored using ASCII or Unicode codes
Images → stored as binary pixel values
Sound → stored as numerical samples
Numbers → represented in binary, hex, or two’s complement
2. Number Systems and Their Bases
Number System Base Digits Used Example Application
Binary 2 0, 1 1101₂ Computer hardware
Octal 8 0–7 35₈ Low-level programming
Decimal 10 0–9 58₁₀ Everyday number representation
Hexadecimal 16 0–9, A–F B3₁₆ Memory addresses, colour codes
Why Different Bases Are Used
Binary is the electronics language of computers.
Hexadecimal shortens long binary sequences.
Decimal is human-friendly.
3. Character Representation (ASCII System)
Every character has a decimal, binary, and hexadecimal code in ASCII.
Character Decimal Hex Binary
E 69 45 01000101
G 71 47 01000111
M 77 4D 01001101
R 82 52 01010010
T 84 54 01010100
Example: Converting a Word to Hexadecimal (NEW EXAMPLE)
Convert the word "GET" to hexadecimal.
G = 71 → 47
E = 69 → 45
T = 84 → 54
Answer: 47 45 54 (hex)
4. Two’s Complement Representation of
Negative Numbers
Two’s complement allows computers to store negative integers using binary.
Steps to Convert a Negative Number
1. Convert the positive value to binary.
2. Ensure it has 8 bits.
3. Invert all bits (0 → 1, 1 → 0).
4. Add 1.
Example (NEW)
Represent –36 in 8-bit two’s complement.
1. +36 = 0010 0100
2. Invert → 1101 1011
3. Add 1 → 1101 1100
Answer: 1101 1100
5. Valid and Invalid Hexadecimal Numbers
Hexadecimal uses 0–9, A–F only.
Anything outside these characters is invalid.
Examples (NEW)
Valid: 9C4F, 02A1, F0B
Invalid:
o Q1B2 (Q not allowed)
o 7Z9 (Z not allowed)
o 3G2 (G not allowed)
6. Binary Addition and Overflow
Binary addition follows four simple rules:
Expression Result
0+0 0
0+1 1
1+0 1
1+1 0 (carry 1)
Example (NEW)
Add 11011011 and 01100101.
11011011
+ 01100101
-----------
100000000 (9 bits)
The result is 9 bits, but an 8-bit register cannot store 9 bits.
Overflow occurs.
The register keeps only the last 8 bits → 00000000
Convert to Hex
00000000₂ → 00₁₆
7. Binary to Hexadecimal Conversion
To convert binary → hex:
1. Group bits into groups of 4 from the right.
2. Convert each group to hexadecimal.
Example (NEW)
Convert 011011100101 to hex.
Group: 0110 1110 0101
→6E5
Answer: 6E5 (hex)
If stored in an 8-bit register
Binary: 011011100101 (12 bits)
Only last 8 bits fit → 11000101
Convert → C5₁₆
8. Sound Representation – Sample Rate vs
Sample Resolution
Computers store sound as samples—tiny measurements of the sound wave.
Sample Rate (Frequency)
Samples per second
Measured in Hz/kHz
Higher sample rate = better frequency detail
Example:
48 kHz sampling → 48,000 samples per second
Sample Resolution (Bit Depth)
Number of bits per sample
Determines number of possible amplitude levels
Higher resolution = better sound precision
Example:
16-bit audio → 65,536 possible amplitude levels
Difference Summary
Sample Rate Sample Resolution
How often sound is recorded How precise each sample is
Affects frequency accuracy Affects dynamic range
9. Summary Table
Concept Example Result
ASCII conversion "GET" → hex 47 45 54
Two’s complement –36 11011100
Valid hex check 9C4F Valid
Binary addition 11011011 + 01100101 Overflow → 00₁₆
Binary → hex 011011100101 6E5
PRACTICE QUESTIONS (with solutions)
Q1. Convert 00111101₂ to hexadecimal.
Solution
0011 1101 → 3 D
Answer: 3D₁₆
Q2. Represent –22 in 8-bit two’s complement.
Solution
22 = 0001 0110
Invert → 1110 1001
Add 1 → 1110 1010
Answer: 11101010
Q3. What is the ASCII decimal and hex code for letter 'H'?
ASCII table:
H = 72 decimal
72 → 48 hex
Answer: 72₁₀, 48₁₆
Q4. Add 10110110 + 10001011 and explain the 8-bit
outcome.
Solution
10110110
+ 10001011
-----------
100000001 (9 bits)
This is 9 bits → overflow
Only the last 8 bits stored → 00000001
Convert to hex → 01₁₆
Answer: Overflow occurs; stored value = 00000001
Q5. Convert 101110010110 to hexadecimal. If stored in 8
bits, what is kept?
Solution
Group: 1011 1001 0110 → B 9 6 → B96₁₆
For 8 bits, last 8 bits = 10010110 → 96₁₆
Answer:
Hex = B96
Stored in 8-bit register = 96
WORKSHEET
SECTION A: Number Systems (Binary,
Decimal, Hexadecimal)
1. Convert the following numbers into the base indicated:
a. Convert 11011010₂ to hexadecimal.
b. Convert 3F₁₆ to binary.
c. Convert 101011₂ to decimal.
d. Convert 92₁₀ to binary (8-bit).
**2. Which of the following are valid hexadecimal numbers?
Circle VALID or INVALID.**
a. 7B9F
b. 41Q2
c. ADF2
d. 98Z1
3. Convert the following binary numbers to hexadecimal, showing working:
a. 000101100010₂
b. 111011011010₂
SOLUTIONS
1. Conversions
a. 11011010₂ → DA₁₆
b. 3F₁₆ → 0011 1111₂
c. 101011₂ → 43₁₀
d. 92₁₀ → 01011100₂
2. Hex Validity
a. 7B9F → VALID
b. 41Q2 → INVALID (Q not allowed)
c. ADF2 → VALID
d. 98Z1 → INVALID (Z not allowed)
3. Binary → Hex
a. 0001 0110 0010 → 1 6 2 → 162₁₆
b. 1110 1101 1010 → E D A → EDA₁₆
SECTION B: ASCII Character Encoding
4. Using the ASCII table principles, answer the following:
a. The character ‘J’ has a decimal ASCII value of 74.
Convert this into binary and hexadecimal.
b. Convert the word "FIRM" into its hexadecimal ASCII representation.
c. Explain why “lowercase letters” have different ASCII values from “uppercase letters.”
SOLUTIONS
4. ASCII
a.
74₁₀ → 01001010₂
74₁₀ → 4A₁₆
b. “FIRM” →
F = 46₁₆
I = 49₁₆
R = 52₁₆
M = 4D₁₆
→ 46 49 52 4D
c. Lowercase letters have different ASCII ranges because the ASCII table assigns
separate decimal values for uppercase (65–90) and lowercase (97–122).
SECTION C: Two’s Complement (Negative
Binary Representation)
5. Convert the following decimal values into 8-bit two’s complement binary:
a. –27
b. –58
c. –7
6. Convert the following two’s complement binary numbers into decimal:
a. 11110110₂
b. 10001111₂
SECTION C SOLUTIONS
5. Two’s Complement
a. –27
27 = 00011011 → invert = 11100100 → +1 → 11100101
b. –58
58 = 00111010 → invert = 11000101 → +1 → 11000110
c. –7
7 = 00000111 → invert = 11111000 → +1 → 11111001
6. Two’s Complement to Decimal
a. 11110110₂
Invert: 00001001 → +1 → 00001010 = 10 → –10
b. 10001111₂
Invert: 01110000 → +1 → 01110001 = 113 → –113
SECTION D: Binary Addition and Overflow
**7. Perform the following binary additions.
State clearly if overflow occurs in an 8-bit register.**
a.
10101011
+ 01101110
b.
11011101
+ 10100011
c. Convert your final 8-bit result from Question 7(a) into hexadecimal.
SOLUTIONS
7. Binary Addition
a.
10101011
+ 01101110
-----------
100110001
9 bits → overflow
Stored value = 00110001
b.
11011101
+ 10100011
-----------
101111000
9 bits → overflow
Stored = 01111000
c. 00110001 → 3 1 → 31₁₆
SECTION E: Sound Representation
8. Differentiate the following clearly:
a. Sample rate vs sample resolution
b. Explain how increasing sample resolution affects file size and audio quality.
c. State two reasons why digital sound files may be large.
SOLUTIONS
8. Sound Representation
a.
Sample rate: number of samples taken per second
Sample resolution: number of bits used per sample
b. Increasing sample resolution:
increases number of amplitude levels
improves sound accuracy
increases file size
c. Reasons digital audio files are large:
1. High sample rate
2. High bit depth
3. Stereo (two channels) or multi-channel audio
SECTION F: Mixed Exam-Style Questions
9. A 10-bit binary number is given as:
1101011110₂
a. Convert it to hexadecimal.
b. If this number must be stored in an 8-bit register, what happens?
c. Write the value that will be stored.
**10. A student claims that “GH5” is a valid hexadecimal number.
Explain why the student is wrong.**
**11. A computer stores a negative number using two’s complement.
The stored 8-bit binary is:**
10011000₂
a. Show how to convert this back to decimal.
b. State whether the number is positive or negative.
c. Give a reason why two’s complement is preferred over sign-and-magnitude.
SOLUTIONS
9. 1101011110₂
a. Group → 1101 0111 10 → 0D 7 A → 35E₁₆
(correct grouping: 0011 0101 1110 → 3 5 E)
b. 8-bit register → cannot store 10 bits → overflow
c. Last 8 bits stored → 01011110₂ (5E₁₆)
10. “GH5”
Hex digits only include 0–9 and A–F.
G and H are not allowed ⇒ invalid.
11. Two’s Complement: 10011000
a. Convert:
Invert → 01100111
+1 → 01101000
= 104 → –104
b. Starts with 1 → negative
c. Two’s complement has one unique zero and easier addition, unlike sign-and-magnitude.