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)
- A. 18446744073709551616 64 0xffffffffffffffff 0o10 0b101
- B. 18446744073709551615 65 0xffffffffffffffff 0o10 0b101
- C. 18446744073709551616 65 0xffffffffffffffff 0o8 0b101
- 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
- What is printed on the first line? python print(int('1' 19) + 1, 1018 10, 9223372036854775807 + 1 > 263 - 1) print(2100 // 298, (2100) >>…
- What is printed? python print(0b1111 ^ 0b1010 & 0b0110, (0b1111 ^ 0b1010) & 0b0110, 6 & 3 | 4 ^ 1)
- What is printed? python print(1 << 2 + 1, (1 << 2) + 1, 4 >> 1 - 1, 2 3 % 4 2 // 3)
- What is printed on the first line? python print(0.5 + 0.25 == 0.75, 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0)…
- What is printed? python print(round(0.5), round(1.5), round(2.5), round(-2.5), round(2.5 + 1e-15))
- What is printed? python print(round(12345, -2), round(12350, -2), round(12250, -2), round(-1234.5, -1))