C- Bitwise Operators Questions and Answers

Practice Mode
Showing 10 of 24 questions
Q1
In which numbering system can the binary number 1011011111000101 be easily converted to?
  • A Decimal system
  • B Hexadecimal system
  • C Octal system
  • D No need to convert
Answer: Option B
Q2
Which bitwise operator is suitable for turning off a particular bit in a number?
  • A && operator
  • B & operator
  • C || operator
  • D ! operator
Answer: Option B
Q3
Which bitwise operator is suitable for turning on a particular bit in a number?
  • A && operator
  • B & operator
  • C || operator
  • D | operator
Answer: Option D
Q4
Which bitwise operator is suitable for checking whether a particular bit is on or off?
  • A && operator
  • B & operator
  • C || operator
  • D ! operator
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; }
  • A 1
  • B 7
  • C 5
  • D 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?
  • A Returns 1 if both bits are 1
  • B Returns 1 if both bits are different
  • C Returns 1 if both bits are same
  • D Returns 0 if both bits are different
Answer: Option B
Explanation: XOR returns 1 only when bits are different
Q7
What is the result of 8 >> 1 in C?
  • A 16
  • B 8
  • C 4
  • D 2
Answer: Option C
Explanation: Right shift by 1 divides number by 2
Q8
Which operator is used for left shift in C?
  • A >>
  • B <<
  • C >>>
  • D ><
Answer: Option B
Explanation: << is left shift operator
Q9
What is the output of: printf("%d", 10 | 5);
  • A 5
  • B 10
  • C 15
  • D 20
Answer: Option C
Explanation: Bitwise OR operation: 10 (1010) OR 5 (0101) = 15 (1111)
Q10
What does the bitwise complement operator (~) do?
  • A Increments the value
  • B Flips all bits
  • C Decrements the value
  • D Doubles the value
Answer: Option B
Explanation: ~ flips all bits (1s complement)
Questions and Answers for Competitive Exams Various Entrance Test