ProgrammingHardProduct-company MCQ pattern

What is printed on the first line?

What is printed on the first line?
n = 2**64
print(n, n.bit_length(), hex(n - 1), oct(8), bin(5))
print(int(hex(n)[2:], 16) == n, -2**63 <= 2**62 < 2**63)
  1. A. 18446744073709551616 64 0xffffffffffffffff 0o10 0b101
  2. B. 18446744073709551615 65 0xffffffffffffffff 0o10 0b101
  3. C. 18446744073709551616 65 0xffffffffffffffff 0o8 0b101
  4. D. 18446744073709551616 65 0xffffffffffffffff 0o10 0b101

Correct answer: D. 18446744073709551616 65 0xffffffffffffffff 0o10 0b101

2**64 has 65 bits, and n - 1 is sixty-four ones in hex. oct() uses the 0o prefix, so oct(8) is 0o10, not 0o8.

More Python Programming questions

Exams that ask this topic