two’s complement/ HEX/ 8-bit integers

3. Two 8-bit integers (two’s complement), x and y, are initialized to 0xAA and 0x00, respectively. What are results of the following operations ? Write them in HEX (non-Hex answers will get partial credits).

a. x>>4 b. ~y

c. x && (-y) d. x & !y

4. Consider the following variables where random() returns an arbitrary but valid value in the given data type (note that f and d are not cast from integer x and can have different values from x).

int x = random(); float f = random(); double d = random();

For each of the following C expression, answer True/False to indicate whether the expression always yields 1 (true). If it always yields True, very briefly describe the underlying mathematical principles. Otherwise, give an example that makes it yield 0.

a. (d + f) – d == f

b. x * x >= 0

c. f*f >= 0

d. x < 0 || -x >=0

"Order a similar paper and get 100% plagiarism free, professional written paper now!"

Order Now