Assume data type int is 32 bits long and uses a twos-complement representation for signed values. Right

Question:

Assume data type int is 32 bits long and uses a two’s-complement representation for signed values. Right shifts are performed arithmetically for signed values and logically for unsigned values. The variables are declared and initialized as follows:

int x = foo(); /* Arbitrary value */ int y = bar(); /* Arbitrary value *

For each of the following C expressions, either 

(1) Argue that it is true (evaluates to 1) for all values of x and y, or 

(2) Give values of x and y for which it is false (evaluates to 0):

A. (x > 0) || (x-1 < 0) B. C. (x * x) >= 0 D. x < 0 11 x 011-x >= 0 F. x+y == uy+ux G. x*-y + uy*ux == -x (x

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Computer Systems A Programmers Perspective

ISBN: 9781292101767

3rd Global Edition

Authors: Randal E. Bryant, David R. O'Hallaron

Question Posted: