Bird
Raised Fist0
Intro to Computingfundamentals~20 mins

How text is stored (ASCII, Unicode) in Intro to Computing - Practice Exercises

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Text Encoding Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding ASCII and Unicode

Which statement best explains the difference between ASCII and Unicode?

AASCII and Unicode are exactly the same in how they store text.
BASCII uses 7 bits per character and supports 128 characters, while Unicode uses multiple bytes to support over a million characters.
CUnicode is an older system that uses fewer bits than ASCII.
DASCII supports all languages worldwide, but Unicode only supports English characters.
Attempts:
2 left
💡 Hint

Think about how many characters each system can represent.

trace
intermediate
1:30remaining
Trace the Unicode encoding of a character

Given the character 'A', what is its Unicode code point and ASCII value?

AUnicode: U+0041, ASCII: 65
BUnicode: U+0061, ASCII: 97
CUnicode: U+0041, ASCII: 97
DUnicode: U+0061, ASCII: 65
Attempts:
2 left
💡 Hint

Remember 'A' uppercase has a different code than 'a' lowercase.

Comparison
advanced
2:00remaining
Comparing storage sizes of ASCII and Unicode

Which option correctly compares the storage size needed for the word 'Hello' in ASCII and Unicode UTF-8 encoding?

A'Hello' uses 5 bytes in ASCII and 10 bytes in UTF-8 Unicode.
B'Hello' uses 10 bytes in ASCII and 5 bytes in UTF-8 Unicode.
C'Hello' uses 5 bytes in ASCII and 15 bytes in UTF-8 Unicode.
D'Hello' uses 5 bytes in ASCII and 5 bytes in UTF-8 Unicode.
Attempts:
2 left
💡 Hint

Consider that ASCII characters are encoded the same way in UTF-8.

identification
advanced
1:30remaining
Identify the error in Unicode representation

Which option shows an incorrect Unicode escape sequence for the character '€' (Euro sign)?

A'\u20AC'
B'\u0024'
C'\u20AG'
D'\u20ac'
Attempts:
2 left
💡 Hint

Unicode escape sequences use hexadecimal digits 0-9 and A-F only.

🚀 Application
expert
2:00remaining
Determine the number of characters stored

A text file contains the string '你好' (two Chinese characters). How many bytes does it take to store this string in UTF-8 encoding?

A6 bytes
B4 bytes
C2 bytes
D8 bytes
Attempts:
2 left
💡 Hint

Each Chinese character typically uses 3 bytes in UTF-8.

Practice

(1/5)
1. What is the main purpose of ASCII in text storage?
easy
A. To compress text files
B. To store images and videos
C. To represent English letters and symbols as numbers
D. To encrypt text data

Solution

  1. Step 1: Understand ASCII's role

    ASCII is a code that assigns numbers to English letters and symbols so computers can store and process them.
  2. Step 2: Compare with other options

    Options A, B, and D describe unrelated functions like storing images, compressing, or encrypting, which ASCII does not do.
  3. Final Answer:

    To represent English letters and symbols as numbers -> Option C
  4. Quick Check:

    ASCII = English letters as numbers [OK]
Hint: ASCII is for English letters and symbols only [OK]
Common Mistakes:
  • Thinking ASCII stores images or videos
  • Confusing ASCII with encryption
  • Assuming ASCII compresses text
2. Which of the following is a correct ASCII code for the uppercase letter 'A'?
easy
A. 97
B. 65
C. 128
D. 256

Solution

  1. Step 1: Recall ASCII codes for letters

    In ASCII, uppercase 'A' is represented by the number 65.
  2. Step 2: Check other options

    97 is lowercase 'a', 128 and 256 are outside standard ASCII range.
  3. Final Answer:

    65 -> Option B
  4. Quick Check:

    ASCII 'A' = 65 [OK]
Hint: Uppercase 'A' in ASCII is 65 [OK]
Common Mistakes:
  • Mixing uppercase and lowercase ASCII codes
  • Choosing numbers outside ASCII range
  • Confusing ASCII with Unicode codes
3. Given the Unicode code point U+1F600, what character does it represent?
medium
A. Smiling face emoji 😀
B. Latin capital letter A
C. Greek letter alpha
D. Digit zero '0'

Solution

  1. Step 1: Identify Unicode code point

    U+1F600 is a Unicode code point in the emoji range.
  2. Step 2: Match code point to character

    U+1F600 corresponds to the smiling face emoji 😀, not letters or digits.
  3. Final Answer:

    Smiling face emoji 😀 -> Option A
  4. Quick Check:

    Unicode U+1F600 = 😀 emoji [OK]
Hint: Unicode U+1F600 is a common emoji code [OK]
Common Mistakes:
  • Assuming all Unicode codes are letters
  • Confusing emoji codes with ASCII
  • Picking digits or Greek letters incorrectly
4. A program tries to store the character 'ñ' using ASCII encoding. What is the likely problem?
medium
A. The character 'ñ' is not in ASCII, causing incorrect storage
B. 'ñ' is stored correctly because ASCII supports all characters
C. The program will convert 'ñ' to uppercase automatically
D. ASCII will store 'ñ' as the number 10

Solution

  1. Step 1: Check ASCII character range

    ASCII supports only basic English letters and symbols, not special characters like 'ñ'.
  2. Step 2: Understand encoding limitations

    Trying to store 'ñ' in ASCII will cause incorrect storage or errors because it is outside ASCII's range.
  3. Final Answer:

    The character 'ñ' is not in ASCII, causing incorrect storage -> Option A
  4. Quick Check:

    ASCII lacks 'ñ' character [OK]
Hint: ASCII covers only basic English letters [OK]
Common Mistakes:
  • Assuming ASCII supports all characters
  • Thinking ASCII converts characters automatically
  • Believing ASCII stores 'ñ' as number 10
5. You want to store text containing English letters, Chinese characters, and emojis. Which encoding should you use?
hard
A. ASCII only
B. Morse code
C. Binary code for numbers only
D. Unicode (like UTF-8)

Solution

  1. Step 1: Identify text types

    The text includes English letters, Chinese characters, and emojis, which require a wide range of characters.
  2. Step 2: Choose suitable encoding

    ASCII supports only English letters; binary code and Morse code are not text encodings. Unicode (like UTF-8) supports all these characters.
  3. Final Answer:

    Unicode (like UTF-8) -> Option D
  4. Quick Check:

    Unicode supports all languages and emojis [OK]
Hint: Use Unicode for all languages and emojis [OK]
Common Mistakes:
  • Choosing ASCII for non-English text
  • Confusing binary code with text encoding
  • Selecting Morse code for digital text storage