ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(hex(2**8 - 1), oct(2**9), bin(2**4))
  1. A. 0xff 0o1000 0b10000
  2. B. 0xff 0o512 0b10000
  3. C. 0xfe 0o1000 0b10000
  4. D. 0xff 0o1000 0b1111

Correct answer: A. 0xff 0o1000 0b10000

2**8 - 1 is 255, which is 0xff in hex. 2**9 is 512, which is 1000 in octal, and 2**4 is 10000 in binary.

More Python Programming questions

Exams that ask this topic