Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
A student knows only one ASCII code: the capital letter A is 65. She needs the codes of the capital letter H and the small letter h for a program.
Work out both codes in denary.
A character set gives each character a binary code. ASCII uses 7 bits (128 codes), usually one byte a character; the letters are in order and a small letter is 32 more than its capital. Unicode has far more characters, including other languages and emojis, so it needs more bits per character. Bits for a text characters bits per character.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Given. A is 65.
Plan. Count on through the alphabet, then add 32 for the small letter.
Step 1. The capital H. H is the 8th letter, so it is 7 places after A. .
Step 2. The small h. .
Check. 72 in binary is 1001000, and 104 is 1101000. The two codes differ only in the bit worth 32, which is the case for every capital and small pair.
Answer: H is 72 and h is 104.
Log in to join the discussion.
Loading…