After running the program below, what will be the values in registers EAX and EBX?
mov EAX,0123ABCDh
mov EBX,4455AABBh
PUSH BX
PUSH AX
POP AX
POP BX
Question 2 options:
EAX=ABCD 0123 EBX=AABB4455 |
|
EAX= ABCD0123 EBX=4455AABB |
|
EAX=0123ABCD EBX=4455AABB |
|
EAX=ABCD0123 EBX=AABB4455 |
Correct Answer:
Explanation:
A stack is a linear data structure in which insertion and deletion operation performed at the top always.
The first two statements load the register EAX and EBX as given below:
EAX = 0123ABCD
EBX = 4455AABB
The register AX and BX have the lower 16 bits of the register EAX and EBX respectively as given below:
AX = ABCD
BX = AABB
The PUSH operation will push the content of the register BX onto the stack, the second PUSH operation push the content of the register AX onto the stack, and the status for the stack after the third instruction will be as given below:
PUSH AX
The fourth instruction POP operation will pop the top element from the stack and load the register AX.
POP AX
The fifth instruction POP operation will pop the top element from the stack and load the register BX.
POP BX
Now, the stack will be empty and the content in the register AX and BX will be as given below:
AX = ABCD
BX = AABB
So, the status of the register EAX and EBX will be as given below:
EAX = 0123ABCD
EBX = 4455AABB
So, only the third option is correct.
Get Answers For Free
Most questions answered within 1 hours.