Question: 2 0 . When adding two n - bit 2 s complement numbers, overflow will NOT occur, if a . Both operands have different sign

20. When adding two n-bit 2s complement numbers, overflow will NOT occur, if
a. Both operands have different sign bits
b. Both operands have same sign bits, and the sign bit of the result is also same
c. Carry-in bits to MSBs are same as the Carry-out bit from the MSB
d. All of the above
21. Consider the following operations on 4-bit twos complement numbers. Which will give
overflow?
a.1110+1111
b.0111+0001
c.1111+0111
d.0110+0001
22. In Java programming language, the char data type is a single 16-bit Unicode character and
implemented as 16-bit unsigned integer. It has a minimum value of '\u0000'(or 0) and a
maximum value of '\uffff'(or 65,535 inclusive). What will be printed when the following code
snippet is executed?
a.65535
b.-1
c.0
d. Run time error
23. In Java programming language the data type byte is implemented as 8-bit twos complement
integer. What will be printed when the following code snippet is executed?
a.128
b.-128
c.0
d. Run time error
24. In Java programming language the data type int is represented as 32-bit twos complement
integer. What will be printed when the following code snippet is executed (0x means Hex
number)? Why?
a.0x10000000, because 0xF +1=0x10
b.0, because 0xFFFFFFFF will be -1
c.-1, because 0xFFFFFFFF will be 0
d.0xFFFFFFFG, because 0xF +1=0xG

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!