🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Error Detection and Correction: all 10 questions

Quiz: Error Detection and Correction · Question 9 of 10

What does this print? (code)

What does this print?

a, b = 0b10110, 0b11100
print(bin(a ^ b).count("1"))
  1. A.1
  2. B.2
  3. C.3
  4. D.5
Answer & explanation

Correct answer: 2

XOR marks the differing positions (01010), and there are two of them.

Can you get the rest right without peeking?

Take the timed Quiz: Error Detection and Correction quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →