For each of the following expressions add a pair of parenthe
Solution
(a) 5 & 6 && 7 & 8
((5&6) && (7&8)) ------ 5 =101,6= 110 ,110&110 = 100 =4 , 7=111,8=1000 , 111&1000=0-----& bitwise operator
((4) && (0))
(4 && 0) ----- && relational operator , 4 = true,0=false
0
(b) 7>6 >>2 <<3 <4
((7>6)>>2)<<(3<4))
((1)>>2)<<(1))
((1>>2)<<1)
(0<<1)
1
(c)
1<<2<7>6>>2
((1<<(((2<7)>6))>>2)
((1<<(1>6))>>2)
((1<<0)>>2)
(0>>2)
0
(d) 4>2<<1 == 5-3
(((4>2)<<1) ==( 5-3))
((1<<1)==(2))
(2 == 2)
1
(e) 12&10|5^2+1
((12&10)|((5^2)+1))
((8)|(7+1)) ^--exclusive or 101^010 = 111=7
(8|8)
8
(f) 3+9>>7-2*2
((3+9)>>(7-(2*2)))
((12)>>(7-(4))
(12>>3)
1
(g) 7-9/2*2%3
(7-((9/2)*(2%3)))
(7-(4*(2))
(7-(8))
(7-8)
-1
(h) !0 | 6 & 3^6
(((!0) | 6 )& (3^6))
((1)|6)&(5))
((1|6)&(5))
(7&5)
4
i) 9%7<<5-3|1
((9%7)<<(5-(3|1)))
((2)<<(5-(3))
(2<<2)
8
(j) 3!=2&&4<=5^4
((3!=2)&&(4<=(5^4)))
(1&&(4<=(1)))
(1&&(4<=1))
(1&&(0))
(1&&0)
0
(k) 7-2==5?3:2+2
((((7-2)==5)?3:2)+2)
(((5 ==5)?3:2)+2)
((3)+2)
5

