ProgrammingVery hardProduct-company MCQ pattern
What is printed?
What is printed?
print(3 ** -2 * 9, (3 ** -2) * 9 == 1.0, 3 ** -2 * 9 == 1)
- A. 1.0 False False
- B. 0.1111111111111111 True True
- C. 1.0 True True
- D. 2.0 True True
Correct answer: C. 1.0 True True
3 ** -2 is the float 0.1111..., and multiplying by 9 rounds back to exactly 1.0 here. Comparing with the int 1 is also True because 1.0 equals 1.
More Python Programming questions
- What is printed? python print(1000000 1000000 == 1012, 106 2 == 1012, 23 2 == 64)
- What is printed? python print(7 & -7, 7 | -7, 7 ^ -7, ~7 & 0xF)
- What is printed? python print(bin(5 & -5), (5).bitcount(), (-5).bitcount(), (-5).bitlength())
- What is printed? python print(0b1 << 100 > 299, (1 << 100).bitlength(), len(bin(1 << 100)) - 2)
- What is printed? python print(float(3) / 2 == 1.5, 3 // 2.0, 3 / 2.0 // 1)
- What is printed? python print(round(3.14159, 3), round(2.5e-7, 7), round(123.456, -1), round(-0.0001, 2))