$Remark:$

One arithmetic shift to left multiplies the number by 2, but we lose left most bits one by one

** **(AshiftL#2, R0)

Answer is (A).

PS: Arithmetic shift to left is same as Logical shift to left.

32 votes

$P$ is a $16$-bit signed integer. The $2$'s complement representation of $P$ is $(F87B)_{16}$. The $2$'s complement representation of $8\times P$ is

- $(C3D8)_{16}$
- $(187B)_{16}$
- $(F878)_{16}$
- $(987B)_{16}$

57 votes

Best answer

Multiplication can be directly carried in 2's complement form. F87B = 1111 1000 0111 1011 can be left shifted 3 times to give 8P = 1100 0011 1101 1000 = C3D8.

Or, we can do as follows:

MSB in (F87B) is 1. So, P is a negative number. So, P = -1 * 2's complement of (F87B) = -1 * (0785) = -1 * (0000 0111 1000 0101)

8 * P = -1 * (0011 1100 0010 1000) (P in binary left shifted 3 times)

In 2's complement representation , this equals, 1100 0011 1101 1000 = C3D8

Correct Answer: $A$

Or, we can do as follows:

MSB in (F87B) is 1. So, P is a negative number. So, P = -1 * 2's complement of (F87B) = -1 * (0785) = -1 * (0000 0111 1000 0101)

8 * P = -1 * (0011 1100 0010 1000) (P in binary left shifted 3 times)

In 2's complement representation , this equals, 1100 0011 1101 1000 = C3D8

Correct Answer: $A$

17

Left shift means adding a 0 at right end, which is equivalent to multiply by 2 in binary. Right shift will be doing division by 2.

22

@Puja you can do it (10*P = 8*P + 2*P) where (8*P) you shift 3 digit left and then for (2*P) you can shift it 1 digit left and then add it.

1

@hem chandra

Left shift is equal to multiplication and right shift equals to division in binary numbers, for the factor of 2 like 2 , 2^2, 2^3 .............

Since here it is 8 , it is 2^3. So we need to shift 3 times

Left shift is equal to multiplication and right shift equals to division in binary numbers, for the factor of 2 like 2 , 2^2, 2^3 .............

Since here it is 8 , it is 2^3. So we need to shift 3 times

0

@krishn.jh It won't be overflow because for overflow $C_{in} \neq C_{out}$ but here $C_{in} = C_{out} = 1$

0

It will be end carry, which is discarded in 2's complement.

And in 2's complement we can forget all 1s in MSBs, except one 1.

Eg. 111011 = 1011

Thus, we can forget the end carry in our result of 8P+2P because sign(negative here) as well as value is still preserved.

And in 2's complement we can forget all 1s in MSBs, except one 1.

Eg. 111011 = 1011

Thus, we can forget the end carry in our result of 8P+2P because sign(negative here) as well as value is still preserved.

0

@Akhilesh ok yes i know as concept says preceding 1's does not affect the values in 2's Complement as they make one partial block.

i got it as after discarding the carry 1, it is not going to affect the final result.

But Be careful as if sum is 0 carry 1 in MSB place then surely there would be Overflow.

i got it as after discarding the carry 1, it is not going to affect the final result.

But Be careful as if sum is 0 carry 1 in MSB place then surely there would be Overflow.

0 votes

$P=(F87B)_{16}=(1111|1000|0111|1011)_{2}:$ **2's compliment representation**

**What is this number ?**

$(0000|0111|1000|0100)_{2}+1=(0000|0111|1000|0101)_{2}=1925$

$So, P\ is =-1925$

$-1925\times 8=-15400$

**Find 2's compliment representation of $-15400$**

$+15400=(0011|1100|0010|1000)_{2}$

$(1100|0011|1101|0111)_{2}+1=(1100|0011|1101|1000)_{2}=(C3D8)_{16}$

**Correct Answer is (A)**