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

1. What will be printed in the second line? Why? a. -32769, because y will be pr

ID: 3897723 • Letter: 1

Question

1.       What will be printed in the second line? Why?

a.       -32769, because y will be pre-decremented before printing                  

b.      -32768, because -32768 is the smallest possible number in 2-byte 2’s compliment representation. B cannot be decremented

c.       32767, because -32768 is the smallest possible number in 2-byte 2’s compliment representation. --B will overflow to the largest possible number.

d.      -1, because -32768 is the smallest possible number in 2-byte 2’s compliment representation.

--B will overflow to the largest possible negative number.

2.       Which of the following operations will overflow in 4-bit two’s compliment representation?

a.       1111 + 1111

b.      0111 + 0001

c.       1000 – 1111

d.      0111 + 1111

BONUS (5 * 4 points)

3.       What is AA – BA in 8-bit unsigned representation? [all numbers are given in hex]

a.       Overflow

b.      10

c.       1A

d.      A1

4.       What is the 8-bit 2’s complement representation of a number which is represented as 8116 in 8-bit sign-magnitude integer representation?

FF16       

1816

1116

Cannot be determined

5.       What is 3B16 + AB16 in 8-bit sign-magnitude representation?

DB16      

1016

2B16

Cannot be determined

6.       What is 1100 – 0001 in 4-bit 2’s compliment representation?

a.       11011 – overflow

b.      1011 = - 5

c.       1100 = -4

d.      1101 = -3

7.       Overflow will occur when adding two in 2’s compliment, if

a.       the signs of the operands are different

b.      there is a carry-out from the MSBs

c.       the signs of the operands are same, and there is a carry-out from the MSBs

d.      the signs of the operands are same, but the sign of the result is different

Explanation / Answer

2) 0111 + 0001

Explanation:

The rules for detecting overflow in a two's complement sum are simple:

0111 + 0001 = 1000 => clearly the result of these +ve numbers is -ve, hence overflown.

3. b. 10

Explanation:

AA - BA = 10101010 - 10111010 = 10101010 + 01000110 = 11110000.

Since, the number is -ve, the result os given by the 2's complement of 11110000 which is 00010000 = 10

6. a.       11011 – overflow

Explanation:

1100 - 0001 = 1100 + (-0001) = 1100 + 1111 = 11101 - OVERFLOW

7.d.      the signs of the operands are same, but the sign of the result is different

Explanation:

The rules for detecting overflow in a two's complement sum are simple:

NOTE : Due to Chegg policy, I could answer only 4 questions. Raise a separate post containing the other questions.