Computers represent characters by associating with each character a specific seq
ID: 3666455 • Letter: C
Question
Computers represent characters by associating with each character a specific sequence of 0’s and 1’s. In this question, you will be dealing with the ASCII and Unicode encodings discussed in class. You can find a table listing the decimal (labeled Dec) and hexadecimal (labeled Hx) codes for each ASCII character (labeled Chr) at
http://www.lookuptables.com
by clicking on the “ASCII table” button near the top of the page. This site also contains tables for Unicode accessible by clicking on the “Unicode v4 Tables” button.
a. Linux and MacOS X systems terminate each line of a text file with a single linefeed (LF) character. Windows terminates each line with two characters: a carriage return character (CR) followed by a linefeed character (LF). What are the ASCII codes for these two characters?
b. In one sentence, explain how given its ASCII code, you would convert a character representing a digit into the numerical value for that digit. For instance, the character ‘7’ would be converted to the integer 7.
c. In one sentence, explain how given its ASCII code, you would convert a lowercase letter into the corresponding uppercase letter.
d. Is the operation from part (c) simpler to describe in decimal or in binary? Why? [1] e. What is the hexadecimal Unicode character for the white smiling face (hint: see “Miscellaneous Symbols”)?v
Explanation / Answer
Ans (a)
For Linefeed ASCII Code is :(LF) (0x0A)= 10
For Carriage Return ASCII Code is (CR) (0x0D)= 13
Ans (b)
For Example
convString="0123456789"
convString[7]=7
Ans (c)
For Example
If you want to Lowercase to Upper Case Letter Take Value of Uppercase Char
Character ' c ' ascii value is = 99 Now You Want Upper Case So Subtract 32 from 99
Thus , 99-32 = 67
So Character 'C' ascii value is =67
For Lowercase a..z Ascii Value is 97..122
So Example 'a' Ascii Value = 97
For Uppercase A..Z Ascii value is 65..90
So Exmple 'A' Ascii Value = 65
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.