...
Question 4317 – UGC NET CS 2006 Dec-paper-2
May 30, 2024
Question 2540 – Computer-Organization
May 30, 2024
Question 4317 – UGC NET CS 2006 Dec-paper-2
May 30, 2024
Question 2540 – Computer-Organization
May 30, 2024

Question 2539 – Computer-Organization

Consider the following program fragment in assembly language :
mov ax, 0h
mov cx, 0A h
doloop:
dec ax
loop doloop
What is the value of ax and cx registers after the completion of the doloop ?

Correct Answer: B

Question 447 Explanation: 
Here ax is assigned value 0 and cx is assigned 0Ah which is equivalent to 10. Within the doloop we decrement the value of ax by 1 and the loop statement decrements cx by 1 untial cx becomes 1.
So
In 1st iteration: ax is decremented by 1, means its latest value will be -1. cx will be decremented by 1, so its latest value will be 9.
In 2nd iteration: ax will become -2. cx will become 8.
In 3rd iteration: ax will become -3. cx will become 7.
In 4th iteration: ax will become -4. cx will become 6.
In 5th iteration: ax will become -5. cx will become 5.
In 6th iteration: ax will become -6. cx will become 4.
In 7th iteration: ax will become -7. cx will become 3.
In 8th iteration: ax will become -8. cx will become 2.
In 9th iteration: ax will become -9. cx will become 1.
In 10th iteration: ax will become -10. cx will become 0.
At this stage the loop breaks as the value of cx is 0. Final value in ax is -10 which in hexadecimal equivalent to FFF6h and cx=0h
Hence option B is the answer.
A
ax=FFF5 h and cx=0 h
B
ax=FFF6 h and cx=0 h
C
ax=FFF7 h and cx=0A h
D
ax=FFF5 h and cx=0A h
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!