Monday 11 November 2013

Question 4: 2's Compliment of Binary Numbers

4. The smallest integer that can be represented by an 8-bit number in 2’s complement form is 
(A) -256 
(B) -128 
(C) -127 
(D) 0

Answer : (B)

Explanation :

Range for n-bit 2's compliment number is : -2^(n-1) to  +(2^(n-1))-1. So, for n-bit number the range would be -128 to +127. So, the answer is B.

Elimination Method
Lets try to see if we can represent the numbers in 2's compliment form.

-256 :  We will need 9 bits to represent 256 in basic unsigned form. So, it is out of question to represent -256 in 2's compliment form in 8 bits.

-128 :
      128 = 1000 0000 => 1000 0000 (in 2's compliment form). So, it looks clear that we can represent 128 in 2's compliment form.

-127 = 0111 1111 => 1000 0001 (in 2's compliment form).

0 = 0000 0000 => 0000 0000 (in 2's compliment form).

So, the lowest number is -128.

Alternate Method

In 2's compliment form, MSB will be 1 for negative numbers. So the number format possible will be
1XXX XXXX

The boundary numbers we can think about would be
1111 1111 or 1000 0000

1111 1111(in 2's compliment) would be => - 0000 0001 i.e., -1
1000 0000 (in 2's compliment) would be => - 1000 0000 i.e., -128

Concepts to Revise
1. What is 2's compliment ? Wiki
2. How to find 2's compliment of a number ?
3. How to find a number corresponding to 2's compliment number ?
4. What are compliments ? Why they are used ?

References
Read Chapter 1(Binary Systems) from Morris Mano.

No comments:

Post a Comment