Excersise 2
Excersise 2
10 Exercise:
mins
1. Convert 82ADh to decimal.
Ans: 35373d
4. Convert 95 to binary.
Ans: 1011111b
18. Show how the character string “RG 2z” is stored in memory, starting at
address 0.
Ans:
Address Contents of Bytes
0 01010010
1 01000111
2 00100000
3 00110010
4 01111010
19. In many applications, it saves time to memorize the conversions among small
binary, decimal, and hex numbers. Fill in the blanks in the following table:
a. 1110b=14d
b. 100101011101b=2397d
c. 46Ah=1130d
d. FAE2Ch=1027628d
10 21. Give the unsigned and signed decimal interpretations of each of the following 16-
mins bit or 8 bit numbers.
Signed unsigned
a. 7FFEh 32766d 32766d
b. 8543h 34115d -31421d
c. FEh -2d -254d
d. 7Fh 7d 7d
23. For each of the following decimal numbers, tell whether it could be stored (a) as a
16-bit number (b) as an 8-bit number.
a. 32767=16 bit
b. -40000= out of range
c. 65536= out of range
d. 257= 16 bit
e. -128= 8 bit
24. For each of the following 16-bit signed numbers, tell whether it is positive or
negative.
a. 1010010010010100b=negative
b. 78E3h=positive
c. CB33h=negative
d. 807Fh=negative
e. 9AC4h=negative
25. If the character string “$12.75” is being stored in memory starting at address 0,
give the hex contents of bytes 0-5.
Ans:
Address Contents of Bytes
0 00100100
1 00110001
2 00110010
3 00101110
4 00110111
5 00110101
26. Translate the following secret message, which has been encoded in ASCII as 41
74 74 61 63 6B 20 44 61 77 6E.
Ans: Attack Dawn.
27. Suppose that a byte contains the ASCII code of an uppercase letter. What hex
number should be added to it to convert it to lower case?
Ans: 20h
28. Suppose that a byte contains the ASCII code of a decimal digit; that is, “0” . . .
“9”. What hex number should be subtracted from the byte to convert it to the
numerical form of the characters?
Ans: 30h