🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Bitwise Operators in C: all 15 questions

Quiz: Bitwise Operators in C · Question 1 of 15

What does this print? (code)

What does this print?

#include <stdio.h>
int main(void) {
    int a = 6, b = 3;
    printf("%d %d %d", a & b, a | b, a ^ b);
    return 0;
}
  1. A.2 7 4
  2. B.2 7 5
  3. C.3 6 5
  4. D.1 7 5
Answer & explanation

Correct answer: 2 7 5

6 is 110 and 3 is 011. AND = 010 (2), OR = 111 (7), XOR = 101 (5).

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 →