Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2’s complement system: You are given four signed integers in different number ba

ID: 3878707 • Letter: 2

Question

2’s complement system: You are given four signed integers in different number bases
A = +(7B)16 B = -(21)8 C = +(153)10 D = +(1111001)2
a) What is the value n, the smallest number of bits needed to represent all of these numbers in 2’s complement representation? In general, using the value found for n, what is the total range of numbers that can be represented?
b) Give the n-bit representations of the four numbers in the 2’s complement system, where n is the value determined in (a).
c) Compute using C + D. Is this the answer you would expect? If not, what change would be needed to allow this computation? Explain.

Explanation / Answer

a)

Compute the two’s complement of number A, B, C, and D.

In binary

Two’c complement

A = +(7C)base 16

01111100

10000100

B = -(21)base8

010001

101111

C = +(153)base10

10011001

1100111

D = +(1111001)base2

1111001

111

Therefore, the smallest number of bits needed to represent all of the numbers in 2’s complement representation is 8.

b)

The representation of numbers with the n-bit represent is shown below:

Here, n= 8 (As per obtained by the above part (a))

A = 10000100

B = 00101111

C = 01100111

D = 00000111

c)

The computation for adding C and D is computed as follows:

C + D = (153)10 + (1111001)2

= (10011001)2 + (1111001)2

= (100010010)2

The decimal representation of (100010010)2 is as follows:

(274)10

The expected value is 274.

Now, by using two complements.

C + D = 1100111 + 0000111

= 1101110

The decimal representation of (1101110)2 is as follows:

110

The value obtain by the two’s complement is 110 which is not the expected value.

In binary

Two’c complement

A = +(7C)base 16

01111100

10000100

B = -(21)base8

010001

101111

C = +(153)base10

10011001

1100111

D = +(1111001)base2

1111001

111

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote