Zero has two representations ina)Sign magnitudeb)2's complementc)1...
Sign Magnitude
+0 = 0000
-0 = 1000
1's complement
+0 = 0000
-0 = 1111
View all questions of this test
Zero has two representations ina)Sign magnitudeb)2's complementc)1...
Zero has two representations in sign magnitude and 1s complement.
Sign magnitude representation:
In sign magnitude representation, the most significant bit (MSB) represents the sign of the number, and the remaining bits represent the magnitude of the number. The sign bit is set to 0 for positive numbers and 1 for negative numbers. However, zero can be represented with either a positive sign or a negative sign, making it have two representations in sign magnitude.
1s complement representation:
In 1s complement representation, the positive numbers are represented as usual in binary form, but the negative numbers are represented by taking the 1s complement of the positive number. The 1s complement of a binary number is obtained by flipping all the bits (0s become 1s and 1s become 0s).
To represent zero in 1s complement, all the bits should be 0. However, zero can be represented in two ways: all bits are 0 (positive zero) and all bits are 1 (negative zero). Negative zero is obtained by taking the 1s complement of positive zero.
Explanation:
In both sign magnitude and 1s complement representations, zero can have two representations. This is because these representations have separate encodings for positive and negative numbers, and zero is considered neither positive nor negative. Therefore, zero can be represented with either a positive sign or a negative sign, resulting in two representations.
2s complement representation:
The 2s complement representation does not have two representations for zero. In 2s complement, the positive numbers are represented as usual in binary form, and the negative numbers are represented by taking the 2s complement of the positive number. The 2s complement of a binary number is obtained by flipping all the bits and adding 1.
In 2s complement, the most significant bit (MSB) is the sign bit. It is set to 0 for positive numbers and 1 for negative numbers. To represent zero, all the bits should be 0, including the sign bit. Therefore, zero has only one representation in 2s complement.
Conclusion:
Zero has two representations in sign magnitude and 1s complement representations, but only one representation in 2s complement representation.
To make sure you are not studying endlessly, EduRev has designed Computer Science Engineering (CSE) study material, with Structured Courses, Videos, & Test Series. Plus get personalized analysis, doubt solving and improvement plans to achieve a great score in Computer Science Engineering (CSE).