What will be the hexadecimal value in the register 𝑎𝑥 (32-bit) after…

2015

What will be the hexadecimal value in the register 𝑎𝑥 (32-bit) after executing the following instructions?

mov al, 15

mov ah, 15

xor al, al

mov cl, 3

shr ax, cl

Codes :

  1. A.

    0F00 h

  2. B.

    0F0F h

  3. C.

    01E0 h

  4. D.

    FFFF h

Attempted by 25 students.

Show answer & explanation

Correct answer: C

Final AX (16-bit): 01E0h (0x01E0)

  • mov al, 15 → AL = 0x0F

  • mov ah, 15 → AH = 0x0F, so AX = 0x0F0F

  • xor al, al → AL = 0x00, so AX = 0x0F00

  • mov cl, 3 → CL = 3

  • shr ax, cl → logical right shift AX by 3: 0x0F00 >> 3 = 0x01E0

Note: 'shr' is a logical shift (zeros shifted in from the left). The register manipulated is AX (16-bit). If the question intended a 32-bit register, operations on AL/AH still affect the lower 16 bits of EAX, and the same final lower-half value 01E0h results.

Explore the full course: Mppsc Assistant Professor