ProgrammingHardTCS CodeVita · Infosys HackWithInfy · Product Company SDE

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

  1. A. 67 16 1
  2. B. 26 0 216
  3. C. 91 0 3
  4. D. 67 0 3

Correct answer: D. 67 0 3

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

More Python Programming questions

Exams that ask this topic