ProgrammingHardTCS NQT · Wipro pattern

What is printed?

What is printed?
print(hex(255), oct(8), bin(-5))
  1. A. 0xff 0o11 -0b101
  2. B. 0xff 010 -0b101
  3. C. 0xff 0o10 -101
  4. D. 0xff 0o10 -0b101

Correct answer: D. 0xff 0o10 -0b101

hex and oct use lowercase digits with the prefixes 0x and 0o, and bin of a negative number puts the minus sign before the 0b prefix.

More Python Programming questions

Exams that ask this topic