CSC114 · 2080 · 5 marks
What is ASCII? Convert 0.2345 from Base 10 to Base 2.
What is ASCII? Convert 0.2345 from Base 10 to Base 2. [5]
ASCII and Base 10 to Base 2 Conversion
Given data
- Number to convert: $0.2345$ (Base 10)
- Target base: Base 2
- Concept asked: ASCII
Part 1: What is ASCII? (2 marks)
ASCII stands for American Standard Code for Information Interchange.
- It is a character encoding standard that assigns a unique numeric code to each character so that text can be represented, stored, and processed in computers.
- Standard ASCII uses 7 bits, giving $2^7 = 128$ possible codes (0 to 127).
- It encodes:
- Uppercase letters A-Z (65-90)
- Lowercase letters a-z (97-122)
- Digits 0-9 (48-57)
- Special/punctuation characters
- Control characters (e.g., newline, tab, carriage return)
- Example:
'A' = 65,'a' = 97,'0' = 48. - Extended ASCII uses 8 bits to represent 256 characters.
Part 2: Convert 0.2345 to Base 2 (3 marks)
Method: Repeatedly multiply the fractional part by 2; the integer part of each product gives the next binary bit (read top to bottom).
| Step | Fraction | ×2 | Product | Bit |
|---|---|---|---|---|
| 1 | 0.2345 | ×2 | 0.4690 | 0 |
| 2 | 0.4690 | ×2 | 0.9380 | 0 |
| 3 | 0.9380 | ×2 | 1.8760 | 1 |
| 4 | 0.8760 | ×2 | 1.7520 | 1 |
| 5 | 0.7520 | ×2 | 1.5040 | 1 |
| 6 | 0.5040 | ×2 | 1.0080 | 1 |
| 7 | 0.0080 | ×2 | 0.0160 | 0 |
| 8 | 0.0160 | ×2 | 0.0320 | 0 |
Reading the integer bits from top to bottom:
$$(0.2345)_{10} \approx (0.00111100)_2$$
Verification: $$0\cdot2^{-1}+0\cdot2^{-2}+1\cdot2^{-3}+1\cdot2^{-4}+1\cdot2^{-5}+1\cdot2^{-6}$$ $$= 0.125 + 0.0625 + 0.03125 + 0.015625 = 0.234375 \approx 0.2345 \checkmark$$
Note: This is a non-terminating binary fraction, so the answer is an approximation to 8 binary places.
$$\boxed{(0.2345)_{10} \approx (0.00111100)_2}$$
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.