
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
-
What is the bool data type in programming?
(Solved)
What is the bool data type in programming?
Date posted:
February 3, 2018
.
Answers (1)
-
How can comments be included in a C++ program?
(Solved)
How can comments be included in a C++ program?
Date posted:
February 3, 2018
.
Answers (1)
-
Give brief descriptions of polymorphism,encapsulation, and inheritance as applied in programming.
(Solved)
Give a brief descriptions of polymorphism, encapsulation, and inheritance as applied in programming.
Date posted:
February 3, 2018
.
Answers (1)
-
Describe importance of computers in education systems.
(Solved)
Describe importance of computers in education systems.
Date posted:
February 2, 2018
.
Answers (1)
-
Outline three advantages of using a mouse as an input device.
(Solved)
Outline three advantages of using a mouse as an input device.
Date posted:
February 2, 2018
.
Answers (1)
-
State THREE examples of utility softwares
(Solved)
State THREE examples of utility softwares.
Date posted:
January 28, 2018
.
Answers (1)
-
State what technology was used to process data during the following stages of computer generations. (a)1st Generation (b)2nd Generation (c)3rd Generation
(Solved)
State what technology was used to process data during the following stages of computer generations. (a)1st Generation (b)2nd Generation (c)3rd Generation
Date posted:
January 28, 2018
.
Answers (1)
-
We could rewrite the drawLogo method so that it has a single parameter: the drawing area.The rewritten method could use input dialogs to obtain...
(Solved)
We could rewrite the drawLogo method so that it has a single parameter: the drawing area.The rewritten method could use input dialogs to obtain the drawing position from the user.What is the drawback of this approach considering a program in java programming language?
Date posted:
January 26, 2018
.
Answers (1)
-
There are 2.54 cm in an inch.Declare a constant in java programming language named cmPerInch, with the correct value.Show how it might be used in...
(Solved)
There are 2.54 cm in an inch.Declare a constant in java programming language named cmPerInch, with the correct value.Show how it might be used in a calculation to convert inches to cm.
Date posted:
January 26, 2018
.
Answers (1)
-
Message dialogs can display a string.What do the following message dialogs display?
JOptionPane.showMessageDialog(null,
‘’5’’ +...
(Solved)
Message dialogs can display a string.What do the following message dialogs display?
JOptionPane.showMessageDialog(null,
‘’5’’ + ‘’5’’ + 5 + 5);
JOptionPane.showMessageDialog(null,
‘’5’’ + ‘’5’’ + (5+5));
Date posted:
January 26, 2018
.
Answers (1)
-
Which of the following variables are allowed in Java, and which have the correct style?Volume, Area, Length, 3 sides, Sidel, length, Mysalary, Your salary, Screensize
(Solved)
Which of the following variables are allowed in Java, and which have the correct style?
Volume
Area
Length
3sides
Sidel
length
Mysalary
Your salary
Screensize
Date posted:
January 26, 2018
.
Answers (1)
-
Write a program which draws a large ‘T’ shape on the screen.
(Solved)
Write a program which draws a large ‘T’ shape on the screen.
Date posted:
January 26, 2018
.
Answers (1)
-
Create a program in java and name it DrawCircle.When the single button is clicked, it should draw a circle of pixel diameter.
(Solved)
Create a program in java and name it DrawCircle.When the single button is clicked, it should draw a circle of pixel diameter.
Date posted:
January 26, 2018
.
Answers (1)
-
Define the term compiler as used in programming
(Solved)
Define the term compiler as used in programming
Date posted:
January 26, 2018
.
Answers (1)
-
Write a program in java language to illustrate reverse sort of an array.The program should sort them in natural, alphabetical order using the default version...
(Solved)
Write a program in java language to illustrate reverse sort of an array.The program should sort them in natural, alphabetical order using the default version of sort();
Date posted:
January 26, 2018
.
Answers (1)
-
State TWO main ways through which data is accessed in a storage media and give an example of a storage media in each case.
(Solved)
State TWO main ways through which data is accessed in a storage media and give an example of a storage media in each case.
Date posted:
January 26, 2018
.
Answers (1)
-
What is a repeater?
(Solved)
What is a repeater?
Date posted:
January 26, 2018
.
Answers (1)
-
Define the following terms (a)attenuation (b)bandwidth (c)multiplexing
(Solved)
Define the following terms (a)attenuation (b)bandwidth (c)multiplexing
Date posted:
January 26, 2018
.
Answers (1)
-
Which device is used to rectify attenuation in a transmission medium?
(Solved)
Which device is used to rectify attenuation in a transmission medium?
Date posted:
January 26, 2018
.
Answers (1)
-
State and briefly explain modes of data communication
(Solved)
The student should have understood computer networking and the modes of communications used.
Date posted:
January 26, 2018
.
Answers (1)