1.

Assume a = 15, b = 20; What will be the result of the following operations?(a) a&b (b) a|b (c) a^b (d) a>>3 (e) (~b)

Answer»
operatoroperationResult
&a&b00001111  a
00010100  b
a&b = (00000100)2 = 410
|a|b00001111  a
00010100  b
a|b = (00011111)2 = 3I10
^a^b00001111  a
00010100  b
a^b = (00011011)2 = 272
>>a>>300001111    a
00000001
a>>3 = 1
~~bb = 00010100    a
~b = -21


Discussion

No Comment Found