Americas
Europe
Q40E
Expert-verifiedFind the two’s complement representations, using bit strings of length six, of the following integers.
a) 22 b) 31 c) −7 d) −19
The one’s complement representations, using bit strings of length six
a) You obtain the binary expansion of an integer by consecutively dividing the integer by 2 until you obtain 0
The successive remainders of each division represents the binary expansion from right to left.
10110
Since 22 is positive, we add a 0 to the left of the binary expansions (to signify a positive number)
b) You obtain the binary expansion of an integer by consecutively dividing the integer by 2 until you obtain 0
c) The successive remainders of each division represents the binary expansion from right to left.
11111
Since 31 is positive, we add a 0 to the left of the binary expansions (to signify a positive number)
011111
d) You obtain the binary expansion of an integer by consecutively dividing the integer by 2 until you obtain 0
The successive remainders of each division represents the binary expansion from right to left.
111
Since two’s complement needs to contain 6 bits, the expansion will need to contain 5 bits, thus add 0’s in front of the binary expansion until we obtain 5 bits.
00111
Since -7 is negative, subtract 00111 from 100000
Note: you could determine the difference by using
Since -7 is negative, we add a 1 to the left of the previous result (to signify a negative number).
111001
e) You obtain the binary expansion of an integer by consecutively dividing the integer by 2 until you obtain 0
The successive remainders of each division represents the binary expansion from right to left.
10011
Since -19 is negative, subtract 10011 from 100000
Note: you could determine the difference by using
Since -19 is negative, we add a 1 to the left of the previous result (to signify a negative number).
101101
94% of StudySmarter users get better grades.
Sign up for free