top of page
Writer's pictureApurba Paul

Fundamentals of Computer_4: Signed Magnitude,-Signed 1’s Complement, 2’s Complement

Number Systems

The language we use to communicate with each other is comprised of words and characters. We understand numbers, characters, and words. But this type of data is not suitable for computers. Computers only understand the numbers.

So, when we enter data, the data is converted into an electronic pulse. Each pulse is identified as code and the code is converted into the numeric format by ASCII. It gives each number, character, and symbol a numeric value (number) that a computer understands. So to understand the language of computers, one must be familiar with the number of systems.

The Number Systems used in computers are:


Binary number systemOctal number system Decimal number systemHexadecimal number system

Binary number system

It has only two digits '0' and '1' so its base is 2. Accordingly, In this number system, there are only two types of electronic pulses; the absence of electronic pulse which represents '0'and presence of electronic pulse which represents '1'. Each digit is called a bit. A group of four bits (1101) is called a nibble and group of eight bits (11001010) is called a byte. The position of each digit in a binary number represents a specific power of the base (2) of the number system.

Octal number system

It has eight digits (0, 1, 2, 3, 4, 5, 6, 7) so its base is 8. Each digit in an octal number represents a specific power of its base (8). As there are only eight digits, three bits (23=8) of binary number system can convert any octal number into binary number. This number system is also used to shorten long binary numbers. The three binary digits can be represented with a single octal digit.

Decimal number system

This number system has ten digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) so its base is 10. In this number system, the maximum value of a digit is 9 and the minimum value of a digit is 0. The position of each digit in a decimal number represents a specific power of the base (10) of the number system. This number system is widely used in our day to day life. It can represent any numeric value.

Hexadecimal number system

This number system has 16 digits that range from 0 to 9 and A to F. So, its base is 16. The A to F alphabets represents 10 to 15 decimal numbers. The position of each digit in a hexadecimal number represents a specific power of the base (16) of the number system. As there are only sixteen digits, four bits (24=16) of binary number system can convert any hexadecimal number into a binary number. It is also known as alphanumeric number system as it uses both numeric digits and alphabets.










Representation of Binary Numbers:

Binary numbers can be represented in signed and unsigned way. Unsigned binary numbers do not have sign bit, whereas signed binary numbers uses signed bit as well or these can be distinguishable between positive and negative numbers. A signed binary is a specific data type of a signed variable.


1. Unsigned Numbers:

Unsigned numbers don’t have any sign, these can contain only magnitude of the number. So, representation of unsigned binary numbers are all positive numbers only. For example, representation of positive decimal numbers are positive by default. We always assume that there is a positive sign symbol in front of every number.

Representation of Unsigned Binary Numbers:

Since there is no sign bit in this unsigned binary number, so N bit binary number represent its magnitude only. Zero (0) is also unsigned number. This representation has only one zero (0), which is always positive. Every number in unsigned number representation has only one unique binary equivalent form, so this is unambiguous representation technique. The range of unsigned binary number is from  0 to (2n-1).

Example-1: Represent decimal number 92 in unsigned binary number.

Simply convert it into Binary number, it contains only magnitude of the given number. = (92)10

= (1x26+0x25+1x24+1x23+1x22+0x21+0x20)10

= (1011100)2

It’s 7 bit binary magnitude of the decimal number 92.

Example-2: Find range of 5 bit unsigned binary numbers. Also, find minimum and maximum value in this range.

Since, range of unsigned binary number is from  0 to (2n-1). Therefore, range of 5 bit unsigned binary number is from  0 to (25-1) which is equal from minimum value 0 (i.e., 00000) to maximum value 31 (i.e., 11111).

2. Signed Numbers:

Signed numbers contain sign flag, this representation distinguish positive and negative numbers. This technique contains both sign bit and magnitude of a number. For example, in representation of negative decimal numbers, we need to put negative symbol in front of given decimal number.

Representation of Signed Binary Numbers:

There are three types of representations for signed binary numbers. Because of extra signed bit, binary number zero has two representation, either positive (0) or negative (1), so ambiguous representation. But 2’s complementation representation is unambiguous representation because of there is no double representation of number 0. These are: Sign-Magnitude form, 1’s complement form, and 2’s complement form which are explained as following below.

2.(a) Sign-Magnitude form:

For n bit binary number, 1 bit is reserved for sign symbol. If the value of sign bit is 0, then the given number will be positive, else if the value of sign bit is 1, then the given number will be negative. Remaining (n-1) bits represent magnitude of the number. Since magnitude of number zero (0) is always 0, so there can be two representation of number zero (0), positive (+0) and negative (-0), which depends on value of sign bit. Hence these representations are ambiguous generally because of two representation of number zero (0). Generally sign bit is a most significant bit (MSB) of representation. The range of Sign-Magnitude form is from  (2(n-1)-1)  to (2(n-1)-1).

For example, range of 6 bit Sign-Magnitude form binary number is from  (25-1)  to (25-1) which is equal from minimum value -31 (i.e., 1 11111) to maximum value +31 (i.e., 0 11111). And zero (0) has two representation, -0 (i.e., 1 00000)  and +0 (i.e., 0 00000).

2.(b) 1’s complement form:

Since, 1’s complement of a number is obtained by inverting each bit of given number. So, we represent positive numbers in binary form and negative numbers in 1’s complement form. There is extra bit for sign representation. If value of sign bit is 0, then number is positive and you can directly represent it in simple binary form, but if value of sign bit 1, then number is negative and you have to take 1’s complement of given binary number. You can get negative number by 1’s complement of a positive number and positive number by using 1’s complement of a negative number. Therefore, in this representation, zero (0) can have two representation, that’s why 1’s complement form is also ambiguous form. The range of 1’s complement form is from  (2(n-1)-1)  to (2(n-1)-1) .

For example, range of 6 bit 1’s complement form binary number is from  (25-1)  to (25-1) which is equal from minimum value -31 (i.e., 1 00000) to maximum value +31 (i.e., 0 11111). And zero (0) has two representation, -0 (i.e., 1 11111)  and +0 (i.e., 0 00000).

2.(c) 2’s complement form:

Since, 2’s complement of a number is obtained by inverting each bit of given number plus 1 to least significant bit (LSB). So, we represent positive numbers in binary form and negative numbers in 2’s complement form. There is extra bit for sign representation. If value of sign bit is 0, then number is positive and you can directly represent it in simple binary form, but if value of sign bit 1, then number is negative and you have to take 2’s complement of given binary number. You can get negative number by 2’s complement of a positive number and positive number by directly using simple binary representation. If value of most significant bit (MSB) is 1, then take 2’s complement from, else not. Therefore, in this representation, zero (0) has only one (unique) representation which is always positive. The range of 2’s complement form is from  (2(n-1))  to (2(n-1)-1).

For example, range of 6 bit 2’s complement form binary number is from  (25)  to (25-1) which is equal from minimum value -32 (i.e., 1 00000) to maximum value +31 (i.e., 0 11111). And zero (0) has two representation, -0 (i.e., 1 11111)  and +0 (i.e., 0 00000).


MCQ Questions

This set of Computer Fundamentals Multiple Choice Questions & Answers (MCQs) focuses on “Sign Magnitude”.

1. __________________ is a straightforward method of representing positive and negative numbers. a) Radix b) Complement c) Sign Magnitude d) Encode

2. The additive inverse of a number is the number which when added to the original number gives 1 as a result. a) True b) False

3. The 1’s complement of 1 in 4 bits is __________ a) 0001 b) 0 c) 1001 d) 1110

4. The binary number 111 in its 2’s complement form is ____________ a) 010 b) 001 c) 000 d) 111

5. The sign magnitude representation of -9 is ___________ a) 00001001 b) 11111001 c) 10001001 d) 11001

6. If you are given a word of size n bits, the range of 2’s complement of binary numbers is ________ a) -2n+1 to +2n+1 b) -2n-1 to +2n-1 c) -2n-1 to +2n+1 d) -2n-1 to +2n-1-1

7. In both signed magnitude and 2’s complement , positive and negative numbers are separated using ______________ a) LSB b) MSB c) 0 d) 1

8. Single Precision format comprises of _________ bits. a) 4 b) 8 c) 16 d) 32

9. If m is the 2’s complement and n is the binary number, then ______________ a) m=n’ b) m=n’+1 c) m=n’-1 d) m=n

10. The possible number of bit patterns with 8 bits ________________ a) 128 b) 8 c) 24 d) 256


Multiple Choice Questions (MCQs): Topic: Signed And Unsigned Numbers : PART- I 1. With 2's complement representation, the range of values that can be represented on the data bus of an 8-bit microprocessor is given by................  a) -128 to +127  b) -128 to +128  c) -127 to +128  d) -256 to +256 2. The 2's complement representation of -17 is .......     a) 0111 0000   b) 0111 1000   c) 1111 0101    d) 1110 111 3. The decimal equivalent of the hexadecimal number E5 is ........     a) 279   b) 229   c) 427   d) 3000 4. How many 1's are present in the binary representation of 3*512 +7*64 +5*8 +3?    a) 8   b) 9   c) 10   d) 11  5. When signed numbers are used in binary arithmetic, then which one of the following notation would have unique representation for 0?    a) Sign Magnitude   b) 1's complement   c) 2's complement   d) 9's complement 6. The 2's complement representation of a 16-bit number (one sign bit, 15 magnitude bits) is FFFF, its magnitude in decimal representation...     a) 0     b) 1    c) 32, 767    d) 65, 535 7. Which of the following weight makes the complement operation easier in BCD form?     a) 8-4-2-1    b) excess-3     c) 2-4-2-1     d) 3-2-1-0  Answer Key : 1. a) -128 to +127   2. d) 0001 0001  3. b) 229    4. b) 9    5. c) 2's complement   6. b) 1  7. a) 8-4-2-1. PART-2 1. The subtraction of a binary number Y from another binary number X, done by adding the 2's complement of Y to X, results in a binary number without overflow. This implies that the result is ............    a) Negative and is in normal form.      b) Negative and in its 2's complement form.   c) Positive and is in normal form.       d) Positive and in its 2's complement form 2. A signed integer has been stored in a byte using the 2's complement format. We wish to store the same integer in a 16-bit word. We should ...........   a) Copy the original byte to the less significant byte of the word and fill the more significant byte with zeros. b) Copy the original byte to the more significant byte of the word and fill the less significant byte with zeros.   c) Copy the original byte to the less significant byte of the word and make each bit of the more significant byte equal to the most significant bit of the original byte.   d) Copy the original byte to the less significant byte as well as the more significant byte of the word. 3. X= 01110 and Y= 11001 are two 5-bit binary numbers represented in two's complement format. The sum of x and y represented in two's complement format using 6-bit is .....    a) 100111     b) 001000    c) 000111     d) 101001 4. 11001, 1000 and 111001 corresponds to the 2's complement representation of which one of the following set of numbers?    a) 25,9 and 57 respectively           b) -6,-6 and -6 respectively    c) -7,-7 and -7 respectively           d) -25,-9 and -57 respectively 5. A new binary coded pentary (BCP) number system is proposed in which every digit of a base-5 is represented by its corresponding 3-bit binary code. For example, base-5 number 24 will be represented by its BCP code 010 100. In this numbering system, the BCP code 100 010 011 001 corresponds to the following number in base -5 systems.    a) 423    b) 1234   c) 2201    d) 4231 Answer Key : 1. b) Negative and in its 2's complement form  2. c) Copy the original byte to the less significant byte of the word and make each bit of the more significant byte equal to the most significant bit of the original byte. 3. c) 000111 4. c) -7,-7 and -7 respectively 5. d) 4231

203 views0 comments

Recent Posts

See All

Comments


bottom of page