174k views
3 votes
8. (P4) a. Suppose you have the following 2 bytes: 01011100 and 01100101. What is the 1s complement of the sum of these 2 bytes? b. Suppose you have the following 2 bytes: 11011010 and 01100101. What is the 1s complement of the sum of these 2 bytes? c. For the bytes in part (a), give an example where one bit is flipped in each of the 2 bytes and yet the 1s complement doesn’t change.

User Odubah
by
4.2k points

1 Answer

2 votes

Answer:

a) 00111110

b) 11000000

c) We get 00111110 when one bit is flipped in each of the 2 bytes and yet the 1s complement doesn’t change.

Step-by-step explanation:

a) The sum of 01011100 and 01100101 is as indicated below:

01011100

+ 01100101

11000001

Therefore, the sum of these 2 bytes 01011100 and 01100101 equals 11000001.

Next we determine the 1s complement, this is usually obtained by reversing the bits i.e 1 to 0 and 0 to 1. Therefore, the 1s complement of 11000001 is 00111110.

Therefore, the 1s complement of the sum of these 2 bytes 01011100 and 01100101 equals 00111110.

b) The sum of 11011010 and 01100101 is as indicated below:

11011010

+ 01100101

00111111

The carry is ignored as we are dealing with 8 bits

Therefore, the sum of these 2 bytes 11011010 and 01100101 equals 00111111.

Next we determine the 1s complement, this is usually obtained by reversing the bits i.e 1 to 0 and 0 to 1. Therefore, the 1s complement of 00111111 is 11000000.

Therefore, the 1s complement of the sum of these 2 bytes 11011010 and 01100101 equals 11000000.

c) Using the 2 bytes in part (a)

The sum of 01011100 and 01100101 is as indicated below:

01011100

+ 01100101

11000001

Therefore, the sum of these 2 bytes 01011100 and 01100101 is 11000001.

The 1s complement of 11000001 is 00111110.

When the most significant bit is flipped 01011100 we get 11011100. We get 11100101 when the most significant bit of 01100101 is flipped.

Now we determine their sum:

11011100

+ 11100101

11000001

The carry is ignored as we are dealing with 8 bits

Therefore, the sum of these 2 bytes 11011100and 11100101 is 11000001.

The 1s complement of 11000001 is 00111110.

We can see that the 1s complement doesn’t change when one bit is flipped in each of the 2 bytes.

User Somebodysomewhere
by
4.1k points