Page 1 of 1

Assume that n and val are int variables. Also assume that the value of n is in the range 0 to 31, inclusive. Which of th

Posted: Fri Jul 08, 2022 6:38 am
by answerhappygod
Assume that n and val are int variables. Also assume that thevalue of n is in the range 0 to 31, inclusive. Which of thefollowing statements sets bit n of val to 0, while leaving theother bits of val unchanged?
Choice 1 of 4: val = (val >> n) << n;Choice 2of 4: val = val | (1 << n);Choice 3 of 4: val = val^ (1 << n);Choice 4 of 4: val = val & ~(1 <<n);