The Gateway to Computer Science Excellence
+29 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

  1. $(C3D8)_{16}$
  2. $(187B)_{16}$
  3. $(F878)_{16}$
  4. $(987B)_{16}$
in Digital Logic by Veteran (105k points)
edited by | 4.7k views


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.

1 Answer

+53 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$
by Veteran (431k points)
edited by
The first one was quite easier. :)
why binary left shift why not right shift ?
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.
ya rgt thanks:)
suppose iif the question asks 10*P then ??
@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.
sir I want to know why should be shift 3 times ?

if it is 9 then ?
@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
if there is 9p then 8p+1p = 2^3p+2^0p (overall three left shifts)
Thank You so much for this explanation :)

Puja Mishra 

If you do 10*P then You will get

= 8*P + 2*P

= 1 1011 0100 1100 1110

This is the Case of Overflow as said in Question P is 16 Bit Signed Integer.

So i guess there will be one option of overflow in this scenario.

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

if you do 8*P + 2*P then no overflow will occur?
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.
@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.

then after left shift by 1 bit it becomes 0100=4 ,why didnt i get 20?
Great Answer!
Can we do division directly on 2's complement form also?
shifting mechanism can't be applied in case of 13*P, right ??

@hem  Does it mean that the value of 8p and 9p will be same ? Please clear ,thank you !


Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,322 answers
105,143 users