ProgrammingModerateTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
x = 5
print(x.__add__(3), (5).bit_length(), 5 .real)
  1. A. 8 3 5.0
  2. B. 2 3 5
  3. C. 8 3 5
  4. D. 8 1 5

Correct answer: C. 8 3 5

int.__add__ is the method behind +, so it returns 8. 5 needs 3 bits, and the real part of an int is the int itself.

More Python Programming questions

Exams that ask this topic