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

Assume you are performing 2\'s complement arithmetic in a computer with 8-bit re

ID: 1995641 • Letter: A

Question

Assume you are performing 2's complement arithmetic in a computer with 8-bit registers. After the following code is run,

signed char a = -12, b = 125, c;

c = a - b;

the binary value of c would be _________ and the decimal value of c would be _______ when printed out.

Assume you are performing 2's complement arithmetic in a computer with 8-bit registers. After the following code is run,

signed char a = 119, b = 123, c;

c = a + b;

the binary value of c would be _______ and the decimal value of c would be ________ when printed out.

Explanation / Answer

1)   10001100 ( -12 IN BINARY) - 01111101 ( 125 IN BINARY)

= 10001100 + 10000010 (NEGATE)

= 00001110 ( Since output can be in 8 digits only .. others will be discarded)

= + 14 (decimal)

2) 119+123

01110111 + 01111011

011110010 ( Binary)

242 (decimal)

Feel free to ask any doubt. Kindly rate up if satisfied.

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