ProgrammingHardTCS CodeVita · Infosys HackWithInfy · Product Company SDE

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

  1. A. 36 24 504
  2. B. 215 24 7
  3. C. 247 24 7
  4. D. 215 6 7

Correct answer: B. 215 24 7

Evaluate shifts, then XOR / AND-NOT / OR per the operator precedence given by the parentheses. Output: 215 24 7.

More Python Programming questions

Exams that ask this topic