Skip to content

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 ?

  1. A
    $ax= FFF5 \: h$ and $cx=0 \:h$
  2. B
    $ax= FFF6 \: h$ and $cx=0 \: h$
    Correct answer
  3. C
    $ax= FFF7 \: h$ and $cx=0A \:h$
  4. 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.