ITPEC FE Morning April 2023 Question 2

When the hexadecimal value ABCD in a 32-bit register is logically shifted right by two bits, which of the following is the resulting value in hexadecimal?

Explanation

2AF3 — a logical right shift moves every bit two places right and fills the vacated top bits with 0.

  • •ABCD in binary (the upper 16 bits of the register are all 0): 1010 1011 1100 1101
  • •Shift right by 2: the low bits 01 fall off and 0s enter at the top, giving 0010 1010 1111 0011
  • •Regroup into hexadecimal: 2AF3

Check: a logical right shift by 2 divides by 4 and drops the remainder. ABCD is 43981, 43981 ÷ 4 = 10995 remainder 1, and 10995 is 2AF3.

Answer (a)

Why not others:

  • •(b) 6AF3 — a rotation right within 16 bits: the two bits 01 that fell off are put back at the top
  • •(c) AF34 — a shift left by 2, with the result cut to 16 bits
  • •(d) EAF3 — an arithmetic shift that copies the top bit of a 16-bit value; in a 32-bit register the top bit is 0, and a logical shift fills with 0 in any case

Key rule: A logical shift always fills with 0s, and the register width decides which bit is on top: a 32-bit register holding ABCD has 16 leading zeros.

Basic Theory · AI-written, may contain errors

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.