IdeasCuriosas - Every Question Deserves an Answer Logo

In Computers and Technology / High School | 2014-02-27

How many bits must be flipped (i.e., changed from 0 to 1 or from 1 to 0) in order to capitalize a lowercase 'a' that’s represented in ASCII?

Asked by KaitlynPeterson

Answer (2)

lowercase a is decimal 97 ; upper case is decimal 65
It's easier to think of them in octal, however: a = octal 141, and A is octal 101
octal to binary is easy, each digit is three bits. 141 = 001 100 001 101 = 001 000 001
So, how many bits are changed above?

Answered by billo | 2024-06-10

To capitalize a lowercase 'a' in ASCII, 2 bits must be flipped: the fourth and sixth bits in the binary representation. The lowercase 'a' is 01100001 (97 in decimal), and the uppercase 'A' is 01000001 (65 in decimal). Thus, the process requires changing these specific bits to achieve the desired capitalization.
;

Answered by billo | 2024-12-24