Question: 1. Given: int a = 2; unsigned int b = -1; When a is compared with b, since unsigned is considered the higher type, C

1. Given: int a = 2; unsigned int b = -1; When a is compared with b, since unsigned is considered the higher type, C promotes a to an unsigned and does the comparison (a > b) as unsigned. Which best describes the result.

A. The result is false because 2 < unsigned interpretation of -1.

B. The result is true because 2 > -1.

C. The result is true because 2 > 1.

D. Signed positive values are always < an unsigned interpretation of a negative value.

E. A and D above are correct.

2. Given: int a = -7;

unsigned int b = a; What can we say about the bit sequences for a and b?

A. The highest order bit in a will be 1.

B. The highest order bit in b will be 1.

C. Both A and B are correct.

D. Most of the bits in bothaandbwill be 1.

E. ll of the above are correct.

Please briefly explain why, that would be helpful.

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!