The data segment starts at 0x10010000 For the following data
The data segment starts at 0x10010000. For the following data, what is the address of the word with the value 5?
.data
.word 4
.word 2
.word 5
A.
0x10010004
B.
0x1001000C
C.
0x10010008
D.
0x10010000
| A. | 0x10010004 | |
| B. | 0x1001000C | |
| C. | 0x10010008 | |
| D. | 0x10010000 |
Solution
Ans) C. 0x10010008
the first data of word 4 is stored in starting adress 0x10010000,next data of word 2 is stored in address of
0x10010000+4=0x10010004,so finally data of word 5 is stored in adress of 0x10010004+4=0x10010008
so answer is C
The word is 32 bit long means 4 byte ,each memory adresses 1 byte ,so for a word of 4 bytes offset is 4,so whenever word is stored in memory, address is augmented by 4
