Solved Problems
Consider a computer that has a byte-addressable memory organized in 32-bit words according to the big-endian scheme. A program reads ASCII characters entered at a keyboard and stores them in successive byte locations, starting at location 1000. Show the contents of the two memory words at locations 1000 and 1004 after the name "Johnson" has been entered.
Hex Decimal Value for J is 4A
Hex Decimal Value for o is 6F
Hex Decimal Value for h is 68
Hex Decimal Value for n is6E
Hex Decimal Value for s is 73
Hex Decimal Value for o is 6F
Hex Decimal Value for n is 6E
Values correspond to the Character below it is
1000 1001 1002 1003 1004 1005 1006 1007
J o h n s o n XX
The Values correspond to the two memory locations 1000 and 1004
1000 : 4A 6F 68 6E
j o h n
1004: 73 6F 6E XX
s o n XX
Note: chars are stored in memory one after another in consecutive locations.
For example if the string
"johnson"
has been stored (assuming a C string convention) the content of memory would be:0x6A 0x6F 0x68 0x6E 0x73 0x6F 0x6E 0x00
In a big endian scheme the two 32-bit words would be
0x6A6F686E
and 0x736F6E00
, In a little-endian scheme they would be
0x6E686F6A
and 0x006E6F73
No comments:
Post a Comment