← Quiz: Bitwise Operators in C: all 15 questions
Quiz: Bitwise Operators in C · Question 13 of 15
What does (x k) & 1 give?
What does (x >> k) & 1 give?
- A.x divided by k
- B.The value (0 or 1) of bit k of x
- C.x with bit k set
- D.The number of set bits in x
Answer & explanation
Correct answer: The value (0 or 1) of bit k of x
Shifting right by k brings bit k to position 0, and & 1 keeps only that bit.
Can you get the rest right without peeking?
Take the timed Quiz: Bitwise Operators in C quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →