Consider these variables unsigned char x 0 times 8E y 0 ti
Consider these variables. unsigned char x = 0 times 8E, y = 0 times 53; char z= 0 times F0; What is the result of the following operations? Write your answer both in binary and two hex digits. x^y = ~x = x & 0 times F1 = x | y = 0 times 00 && x = x && y = ! x = x 2 = z >> 3 =
Solution
the given values in decimal are
x=142 and y= 83 and z=240
in binary
x=10001110,y=01010011 and z=11110000
x^y(XOR)=10001110 ^ 01010011 =11011101
~x= 01110001
x&0xF1 =10000000
x|y (OR) =11011111
0x00 && x=0
x && y =000000001
!x=00000000
x<<2(left shift):0000001000111000
y>>2(Right Shift) :00010100
z>>3:00011110
