Question: Suppose a computer uses 4-bit one's complement representation. Ignoring overflows, what value will be stored in the variable j after the following pseudocode routine terminates?
Suppose a computer uses 4-bit one's complement representation. Ignoring overflows, what value will be stored in the variable j after the following pseudocode routine terminates?
0 -> j // Store 0 in j
-3 -> k // Store -3 in k
while k 0
j = j + 1
k = k - 1
Create a table showing the trace for j and k in decimal and binary. Remember that in one's complement addition, the last carry is added to the sum). Here are the first two lines of the table:
| j | (binary) | k | (binary) |
| 0 | 0000 | -3 | 1100 |
| 1 | 0001 | -4 | 1011 |
Complete the table using whatever editor you prefer (hand drawn neatly is OK)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
