In: Computer Science
Suppose I have a 32 bit register containing 0000AC12 in hex and I do a logical shift >>2. What hex digits will result from the binary shift? Be sure to show all 32 bits in hex
Hexadecimal Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111
Use this table to convert from hexadecimal to binary
Converting 0000AC12 to binary
0 => 0000
0 => 0000
0 => 0000
0 => 0000
A => 1010
C => 1100
1 => 0001
2 => 0010
So, in binary 0000AC12 is 00000000000000001010110000010010
logical shift >> 2, shifts this number to right by 2 bits
so, 00000000000000001010110000010010 becomes 00000000000000000010101100000100
Let's convert this back to hexadecimal
Converting 00000000000000000010101100000100 to hexadecimal
0000 => 0
0000 => 0
0000 => 0
0000 => 0
0010 => 2
1011 => B
0000 => 0
0100 => 4
So, in hexadecimal 00000000000000000010101100000100 is 00002B04
Answer: 00002B04