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

Questions 1a through 1c are about a computer that represents integers in 16-bit,

ID: 3864433 • Letter: Q

Question

Questions 1a through 1c are about a computer that represents integers in 16-bit, two's complement form. 1a. How would the computer represent the integer 7734? Your answer must be a binary (base 2) number, without a sign. 1b. How would the computer represent the integer -7734? Your answer must be a binary (base 2) number, without a sign. 1c. Can the computer represent a non-zero integer n such that n = -n? If it can, then show that number in decimal (base 10) form. If it cannot, then explain why not.

Explanation / Answer

1a. How would the computer represent the integer 7734? Your answer must be binary (base 2), without a sign.
7734 / 2 = 3867   with a remainder of 0.
3867 / 2 = 1933 with a remainder of 1.
1933 / 2 = 966 with a remainder of 1.
966 / 2 = 483 with a remainder of 0.
483 / 2 = 241 with a remainder of 1.
241 / 2 = 120 with a remainder of 1.
120 / 2 = 60 with a remainder of 0.
60 / 2 = 30 with a remainder of 0.
30 / 2 = 15 with a remainder of 0.
15 / 2 = 7 with a remainder of 1.
7 / 2 = 3 with a remainder of 1.
3 / 2 = 1 with a remainder of 1.
1 / 2 = 0 with a remainder of 1.
Therefore, the binary representation of 7734 is: 0001 1110 0011 0110   


1b. How would the computer represent the integer -7734? Your answer must be binary (base 2), without a sign.
7734 / 2 = 3867   with a remainder of 0.
3867 / 2 = 1933 with a remainder of 1.
1933 / 2 = 966 with a remainder of 1.
966 / 2 = 483 with a remainder of 0.
483 / 2 = 241 with a remainder of 1.
241 / 2 = 120 with a remainder of 1.
120 / 2 = 60 with a remainder of 0.
60 / 2 = 30 with a remainder of 0.
30 / 2 = 15 with a remainder of 0.
15 / 2 = 7 with a remainder of 1.
7 / 2 = 3 with a remainder of 1.
3 / 2 = 1 with a remainder of 1.
1 / 2 = 0 with a remainder of 1.
Therefore, -7734 is: - 0001 1110 0011 0110.
But as you don't want sign to appear in your answer, to represent a negative number,
we need to 2's complement the number.
So, 1's complement of 0001 1110 0011 0110 is: 1110 0001 1100 1001.
And 2's complement of the same number is: 1110 0001 1100 1010.
So, -7734 is: 1110 0001 1100 1010.

1c. Can the computer represent a non-zero integer n such that n = -n? If it can, then
show that number in decimal form. If it cannot, then explain why not?
Yes a non-zero integer n such that n = -n can be represented on a computer. If the variable,
is declared unsigned, then sign doesn't makes any impact on the variable, and all the bits
will be used for the number representation.