The following program is stored in memory unit of the basic computer. What is the content of the accumulator after the execution of program? (All location numbers listed below are in hexadecimal). Location Instruction 210 CLA 211 ADD 217 212 INC 213 STA 217 214 LDA 218 215 CMA 216 AND 217 217 1234H 218 9CE2H
The following program is stored in memory unit of the basic computer. What is the content of the accumulator after the execution of program? (All location numbers listed below are in hexadecimal). Location Instruction 210 CLA 211 ADD 217 212 INC 213 STA 217 214 LDA 218 215 CMA 216 AND 217 217 1234H 218 9CE2H Correct Answer 0215H
The correct answer is option 4.
Explanation
|
Location |
Instruction |
execution of program |
|
210 |
CLA |
Clear accumulator (set to 0) |
|
211 |
ADD 217 |
Add contents of location 217 i.e 1234 h to accumulator |
|
212 |
INC |
Increment accumulator by 1 so accumulator contain 1235 H |
|
213 |
STA 217 |
Store this value 1235 H at location 217 |
|
214 |
LDA 218 |
Load accumulator with the content of 218 so accumulator now has 9CE2 H |
|
215 |
CMA |
Complement (1’s complement) accumulator so accumulator now have 631D H |
|
216 |
AND 217 |
Perform bitwise AND operation with the content of 217 i.e with 1235 H i.e and of 631D H & 1235 H which will be 0215 H |
|
217 |
1234 H |
|
|
218 |
9CE2 H |
(9CE2)16 = (1001 1100 1110 0010)2
1's complement of (9CE2)16 = (0110 0011 0001 1101)2 = (631D)16
(631D)16 & (1235)16 = (0215)16
Hence the correct answer is 0215H.