Question: 16. 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

16. 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.

byte a = 127; // or a = 0x7F

System.out.println(++a);

In Java programming language the data type byte is implemented as 8-bit twos compliment integer. What will be printed when the following code snippet is executed?

a. 128

b. -128

c. 0

d. Run time error

22. In Java programming language the data type int is represented as 32-bit twos compliment integer. What will be printed when the following code snippet is executed (0x stand for Hex)? Why?

int b = 0xFFFFFFFF; // hex representation

System.out.println(++b);

a. 0x10000000, because 0xF + 1 = 0x10

b. 0, because 0xFFFFFFFF will be stored as -1

c. -1, because 0xFFFFFFFF will be stored as 0

d. 0xFFFFFFFG, because 0xF + 1 = 0xG

26.

lw $8, 4($16)

sw $8, 0($16)

Consider the following code: Assume $16 has the starting address of an array A. Which of the following Java code describes this MIPS code?

a. A[8] = A[16]

b. A[0] = A[1]

c. A[1] = A[0]

d. A[A[16]+4] = A[8]

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 Databases Questions!