Complete the code to perform bitwise AND of two numbers.
result = a [1] bThe 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.
result = x [1] yThe 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.
result = num1 [1] num2The bitwise XOR operator ^ returns 1 only if the bits are different.
Fill both blanks to perform left shift and right shift operations.
left_shift = val [1] 2 right_shift = val [2] 2
Left shift << moves bits to the left, multiplying by powers of two.
Right shift >> moves bits to the right, dividing by powers of two.
Fill all three blanks to create a dictionary with keys as numbers, values as bitwise NOT of keys, and filter keys greater than 2.
result = { [1]: [2] for [3] in range(5) if [3] > 2 }We use num as the loop variable and key.
The value is bitwise NOT of num, written as ~num.
Filter keeps numbers greater than 2.