ProgrammingHardTCS CodeVita · Infosys HackWithInfy · Product Company SDE

What does the following Python 3 code print? a, b, c = 25, 3, 17 print((a << b) ^ c, a & ~c, (a | c) >> b)

  1. A. 217 0 2
  2. B. 18 8 200
  3. C. 217 17 3
  4. D. 217 8 3

Correct answer: D. 217 8 3

Evaluate shifts, then XOR / AND-NOT / OR per the operator precedence given by the parentheses. Output: 217 8 3.

More Python Programming questions

Exams that ask this topic