ProgrammingHardProduct-company MCQ pattern
What is printed?
What is printed?
print(1_000_000 * 1_000_000 == 10**12, 10**6 ** 2 == 10**12, 2**3 ** 2 == 64)
- A. True True False
- B. False False False
- C. True False True
- D. True False False
Correct answer: D. True False False
** binds tighter than the surrounding operations and is right-associative, so 10**6 ** 2 is 10**36, not (10**6)**2. Likewise 2**3 ** 2 is 2**9 = 512.
More Python Programming questions
- 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))
- What is printed? python print('Hello World'.swapcase().title(), 'tEST'.capitalize(), 'x'.isalpha(), '1.5'.isdigit(), '١٢'.isdigit())