Encode the following sentences in ASCII using even parity by adding a parity bit at the high-order end of each character code:
a. Does 100/5 = 20?
b. The total cost is $7.25.
The Correct Answer and Explanation is :
ASCII Encoding with Even Parity
Each character in the given sentences is represented in 7-bit ASCII format. To ensure even parity, we add a parity bit at the high-order (most significant) end, making the total 8-bit representation. The parity bit is 0 if the number of 1s in the 7-bit ASCII is even, and 1 if the number of 1s is odd, ensuring an even number of 1s in each byte.
Solution
Sentence (a): “Does 100/5 = 20?”
- Convert each character into 7-bit ASCII.
- Count the number of 1s in each 7-bit representation.
- Add a parity bit (1 if the count is odd, 0 if even).
| Character | ASCII (7-bit) | # of 1s | Parity Bit | 8-bit Encoding |
|---|---|---|---|---|
| D | 1000100 | 2 | 0 | 01000100 |
| o | 1101111 | 6 | 0 | 01101111 |
| e | 1100101 | 4 | 0 | 01100101 |
| s | 1110011 | 4 | 0 | 01110011 |
| (space) | 0100000 | 1 | 1 | 10100000 |
| 1 | 0110001 | 3 | 1 | 10110001 |
| 0 | 0110000 | 2 | 0 | 00110000 |
| 0 | 0110000 | 2 | 0 | 00110000 |
| / | 0101111 | 5 | 1 | 10101111 |
| 5 | 0110101 | 4 | 0 | 0110101 |
| (space) | 0100000 | 1 | 1 | 10100000 |
| = | 0111101 | 5 | 1 | 10111101 |
| (space) | 0100000 | 1 | 1 | 10100000 |
| 2 | 0110010 | 3 | 1 | 10110010 |
| 0 | 0110000 | 2 | 0 | 00110000 |
| ? | 0111111 | 6 | 0 | 01111111 |
Sentence (b): “The total cost is $7.25.”
Following the same method, the 8-bit ASCII with even parity encoding is:
| Character | ASCII (7-bit) | # of 1s | Parity Bit | 8-bit Encoding |
|---|---|---|---|---|
| T | 1010100 | 3 | 1 | 11010100 |
| h | 1101000 | 3 | 1 | 11101000 |
| e | 1100101 | 4 | 0 | 01100101 |
| (space) | 0100000 | 1 | 1 | 10100000 |
| t | 1110100 | 4 | 0 | 01110100 |
| o | 1101111 | 6 | 0 | 01101111 |
| t | 1110100 | 4 | 0 | 01110100 |
| a | 1100001 | 3 | 1 | 11100001 |
| l | 1101100 | 4 | 0 | 01101100 |
| (space) | 0100000 | 1 | 1 | 10100000 |
| c | 1100011 | 4 | 0 | 01100011 |
| o | 1101111 | 6 | 0 | 01101111 |
| s | 1110011 | 4 | 0 | 01110011 |
| t | 1110100 | 4 | 0 | 01110100 |
| (space) | 0100000 | 1 | 1 | 10100000 |
| i | 1101001 | 4 | 0 | 01101001 |
| s | 1110011 | 4 | 0 | 01110011 |
| (space) | 0100000 | 1 | 1 | 10100000 |
| $ | 0100100 | 2 | 0 | 00100100 |
| 7 | 0110111 | 5 | 1 | 10110111 |
| . | 0101110 | 4 | 0 | 00101110 |
| 2 | 0110010 | 3 | 1 | 10110010 |
| 5 | 0110101 | 4 | 0 | 0110101 |
| . | 0101110 | 4 | 0 | 00101110 |
Explanation (300 Words)
Parity bits are used in digital communication and storage systems for error detection. Even parity ensures that each byte has an even number of 1s. If an error occurs (e.g., a single bit flips), the receiver can detect it because the parity will be incorrect.
Each character in ASCII encoding is represented in 7-bit format. The 8th bit (parity bit) is added based on the number of 1s in the character. If the count of 1s is odd, we set the parity bit to 1 to make it even. If it’s already even, we set it to 0.
For example, the character ‘D’ has a 7-bit ASCII of 1000100 (two 1s). Since the count is already even, the parity bit is 0, making the final 8-bit encoding 01000100.
This method is useful in low-level data transmission, such as serial communication (UART), memory storage, and network protocols. If a single bit error occurs during transmission, the system detects it by checking parity. If the parity does not match, an error is flagged, and retransmission may be requested.
However, parity checking cannot correct errors—it only detects them. More advanced error detection techniques, such as Hamming codes or CRC (Cyclic Redundancy Check), are used for both error detection and correction.
Generated Image
Now, I will generate an image illustrating the ASCII encoding with parity bits.

I have generated an image illustrating ASCII encoding with even parity, including a table that visually represents the encoding process. Let me know if you need any modifications or further explanations!