Open In App

GATE | GATE CS 2010 | Question 8

Like Article
Like
Save Article
Save
Share
Report issue
Report

P is a 16-bit signed integer. The 2\’s complement representation of P is (F87B)16.The 2\’s complement representation of 8*P
 

(A)

(C3D8)16
 

(B)

(187B)16
 

(C)

(F878)16
 

(D)

(987B)16
 


Answer: (A)

Explanation:

Explanation:

P = (F87B)16 is -1111 1000 0111 1011 in binary

Note that most significant bit in the binary representation is 1, which implies that the number is negative. To get the value of the number performs the 2’s complement of the number. We get P as -1925 and 8P as -15400 

Since 8P is also negative, we need to find 2’s complement of it (-15400) 
Binary of 15400 = 0011 1100 0010 1000 
2\’s Complement = 1100 0011 1101 1000 = (C3D8)16
 

Explanation 2 : (Easy way):

P = (F87B)16 is (1111 1000 0111 1011)2 in binary 

Note that the most significant bit in the binary representation is 1, which implies that the number is negative. To get the value of the number, the 2’s complement of the number is performed. We get P as -1925

The binary of (1925)10 is (0000 0111 1000 0101)2

Now 8P= left shift P 3 times = (0011 1100 0010 1000)2   for a negative sign it is  (1011 1100 0010 1000)2

2’s Complement = 1100 0011 1101 1000 = (C3D8)16

Quiz of this Question
Please comment below if you find anything wrong in the above post
 


Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 02 Nov, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads