C- Bitwise Operators Questions and Answers
Practice ModeShowing 10 of 24 questions
Q1
In which numbering system can the binary number 1011011111000101 be easily converted to?
Answer: Option B
Q2
Which bitwise operator is suitable for turning off a particular bit in a number?
Answer: Option B
Q3
Which bitwise operator is suitable for turning on a particular bit in a number?
Answer: Option D
Q4
Which bitwise operator is suitable for checking whether a particular bit is on or off?
Answer: Option B
Q5
What is the output of the following code?
int main() {
int a = 5, b = 3;
printf("%d", a & b);
return 0;
}
Answer: Option A
Explanation: Bitwise AND operation: 5 (binary 101) AND 3 (binary 011) = 1 (binary 001)
Q6
What does the bitwise XOR operator (^) do?
Answer: Option B
Explanation: XOR returns 1 only when bits are different
Q7
What is the result of 8 >> 1 in C?
Answer: Option C
Explanation: Right shift by 1 divides number by 2
Q8
Which operator is used for left shift in C?
Answer: Option B
Explanation: << is left shift operator
Q9
What is the output of: printf("%d", 10 | 5);
Answer: Option C
Explanation: Bitwise OR operation: 10 (1010) OR 5 (0101) = 15 (1111)
Q10
What does the bitwise complement operator (~) do?
Answer: Option B
Explanation: ~ flips all bits (1s complement)