Two eight bit bytes 1100 0011 and 0100 1100 are added. What are the values of…
2013
Two eight bit bytes 1100 0011 and 0100 1100 are added. What are the values of the overflow, carry and zero flags respectively, if the arithmetic unit of the CPU uses 2's complement form? ISRO 2013
- A.
0, 1, 1
- B.
1, 1, 0
- C.
1, 0, 1
- D.
0, 1, 0
Attempted by 34 students.
Show answer & explanation
Correct answer: D
First, interpret the bytes in 2's complement: 1100 0011 represents -61 and 0100 1100 represents 76. Adding them gives -61 + 76 = 15, which is 0000 1111 in binary. For the Overflow flag: compare carry-in and carry-out of the MSB. Carry-in to bit 7 is 1, and carry-out from bit 7 is 1. Since they match, Overflow = 0. For the Carry flag: it is the final carry-out from the MSB, which is 1. For the Zero flag: since the result (0000 1111) is not zero, Zero = 0. Thus, the flags are 0, 1, and 0 respectively.