Using 4 bit numbers, for example (5)10 = ( 0101)2 Write all positive numbers and all negative numbers that can be represented....

      

Using 4 bit numbers, for example (5)10 = ( 0101)2 Write all positive numbers and all negative numbers that can be represented with four bits in sign-magnitude, one’s complement, and two’s complement.

  

Answers


Kiprop
Here's a brief description about all the three representation techniques

Sign and Magnitude Representation

In this representation, we can represent numbers in any number of bits (powers of 2). There are two parts in the representation. Sign and Magnitude, as the name implies.

If we want to represent a number in n number of bits,

the first bit always represents the sign of the number. i.e. 0 for a positive number and 1 for a negative number.
the remaining bits (n-1) represent the magnitude of the number in Binary.
e.g. If you want to represent +25 and -25 using 8 bits: (+25)10 = 0011001 and (-25)10 = 10011001

Complement

Since Binary number system has only 2 digits (0 and 1), the complement of one digit is the other. i.e. the complement of 0 is 1 and vice versa.

One's Complement

In this representation, there is no specific bit to represent the sign, but the MSB (Most Significant Bit) can be used to determine the sign of the number. i.e. MSB is 0 if the number is positive and 1 if the number is negative. Binary numbers are used and also a specific bit size is used. (e.g. 8, 16, 32, etc. bits).

If the number is positive

Convert the number to binary
Set the number to specific bit size
If the number is negative

Convert the number to binary
Set the number to specific bit size
Get the complement of that value
e.g. Take the previous example again

(+25)10
Convert the number to binary -> (11001)2
Set the number to specific bit size -> (0001 1001)
(-25)10
Convert the number to binary -> (11001)2
Set the number to specific bit size -> (0001 1001)
Get the complement of that value -> (1110 0110)
Two's Complement

This representation technique is very much similar to One's Complement Representation. The main difference is that when the number is negative, 1 is added to the LSB (Least Significant Bit) after getting the complement.

e.g. Let us take the same example

(+25)10
Convert the number to binary -> (11001)2
Set the number to specific bit size -> (0001 1001)
(-25)10
Convert the number to binary -> (11001)2
Set the number to specific bit size -> (0001 1001)
Get the complement of that value -> (1110 0110)
Add 1 to LSB -> (1110 0110) + 1 = (1110 0111)
Ndalut answered the question on February 4, 2018 at 19:26


Next: Rewrite the following extract in a passive voice
Previous: What is the relationship between consumer needs and product utility?

View More Computer Studies Questions and Answers | Return to Questions Index


Exams With Marking Schemes

Related Questions