Complete the code to perform bitwise AND of two numbers.
const result = a [1] b;| instead of AND.^ which returns 1 when bits differ.The bitwise AND operator & compares each bit of two numbers and returns 1 only if both bits are 1.
Complete the code to perform bitwise OR of two numbers.
const result = x [1] y;& instead of OR.>> which shifts bits.The bitwise OR operator | compares each bit of two numbers and returns 1 if at least one bit is 1.
Fix the error in the code to perform bitwise XOR of two numbers.
const result = num1 [1] num2;| or AND & instead of XOR.~ which flips bits.The bitwise XOR operator ^ returns 1 only when the bits are different.
Fill both blanks to perform left shift by 3 bits and then bitwise NOT.
const shifted = value [1] 3; const result = [2]shifted;
>> instead of left shift.Left shift operator << moves bits to the left by given positions. Bitwise NOT ~ flips all bits.
Fill all three blanks to perform right shift by 2 bits, then bitwise AND with mask 15, and finally bitwise OR with 8.
const shifted = num [1] 2; const masked = shifted [2] 15; const result = masked [3] 8;
<< instead of right shift.^ instead of OR.Right shift >> moves bits right. Bitwise AND & masks bits. Bitwise OR | sets bits.
