UGC NET CS 2017Computer System Architecture › Programming the Basic ComputerVerified
UGC NET CS 2017 PYQ: Consider the following program fragment in assembly language: mov ax, 0h mov cx, 0A h do loop: dec ax loop…
Consider the following program fragment in assembly language:
mov ax, 0h
mov cx, 0A h
do loop:
dec ax
loop doloop What is the value of $ax$ and $cx$ registers after the completion of the doloop ?
- A$ax= FFF5 \: h$ and $cx=0 \:h$
- B$ax= FFF6 \: h$ and $cx=0 \: h$Correct answer
- C$ax= FFF7 \: h$ and $cx=0A \:h$
- D$ax=FFF5 \: h$ and $cx=0A \: h$
Answer
(B) $ax= FFF6 \: h$ and $cx=0 \: h$
Approach
Trace the 8086 LOOP instruction with CX as the counter and DEC on AX.
Reviewed by UGC IQ Editorial Team.