233 views
4 4 votes

Given that $A$ and $B$ are two $8$-bit $2$’s complement numbers where $A=10000001$ and $B=11111110$, then the sum $A+B$ is:

  1. $01111111$
     
  2. $10000011$
     
  3. $01111101$
     
  4. $11111111$

3 Answers

1 1 vote

To find the sum of the two $8$-bit $2$'s complement numbers $A$ and $B$, we can perform standard binary addition and discard any carry that exceeds the $8$th bit (since we are restricted to an 8-bit system).

Here are the numbers:

$A = 10000001$

$B = 11111110$

Let's align them and add them bit by bit:

$$\begin{array}{@{}c@{\quad}cccccccc} & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ + & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 0 \\ \hline \mathbf{1} & \mathbf{0} & \mathbf{1} & \mathbf{1} & \mathbf{1} & \mathbf{1} & \mathbf{1} & \mathbf{1} & \mathbf{1} \end{array}$$

The result of the binary addition is $101111111$, which is $9$ bits long. Because this is an 8-bit system, we discard the most significant bit (the carry-out bit).

The remaining $8$ bits give us:

$01111111$

(Note: If you look at their decimal values, $A = -127$ and $B = -2$. Their true sum is $-129$, which falls outside the valid 8-bit 2's complement range of $-128$ to $+127$. This means an overflow occurred, which is why the addition of two negative numbers resulted in a positive binary representation. However, the hardware simply performs the binary addition and truncates the carry, giving the 8-bit result).

The correct option is A. $01111111$.

Answer:
Position:
Show:

Related questions

4 4 votes
2 2 answers
209
209 views
2 2 votes
2 2 answers
208
208 views
GO Classes asked Jun 2
208 views
The smallest integer that can be represented using a $12$-bit number in $2$’s complement form is
4 4 votes
1 1 answer
175
175 views
GO Classes asked Jun 2
175 views
In an $n$-bit signed number system, zero has exactly $2$ different representations in which of the following representations?Sign-magnitude and $1$’s complement only $2$’...
8 8 votes
2 2 answers
221
221 views
GO Classes asked Jun 2
221 views
Let $X$ be the number of distinct $12$-bit integers representable in $2$’s complement form. Let $Y$ be the number of distinct $12$-bit integers representable in $1$’s com...