ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(len(bin(-1)), len(hex(255)), oct(64))
  1. A. 4 4 0o100
  2. B. 3 4 0o100
  3. C. 4 4 100
  4. D. 4 3 0o100

Correct answer: A. 4 4 0o100

bin(-1) is the four-character string -0b1, and hex(255) is 0xff with four characters. oct(64) is 0o100 with the 0o prefix.

More Python Programming questions

Exams that ask this topic