ProgrammingHardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(len(bin(10 ** 6)) - 2, len(bin(2 ** 20)) - 2)
- A. 20 21
- B. 20 20
- C. 19 21
- D. 21 21
Correct answer: A. 20 21
10**6 is below 2**20 and at least 2**19, so it has 20 bits. 2**20 itself has 21 bits.
More Python Programming questions
- What is printed? python print(max(range(10), key=lambda x: x % 4), min([], default=7))
- What is printed? python print(3 -1, 7 // 0.5, 2 0.5 2 0.5 == 2)
- What is printed? python print(float('%.2f' % 0.125), '%.3e' % 12345.678)
- What is printed? python print(int(str(2 70)[:5]), len(str(2 70)))
- What is printed? python print(list(range(10, 0, -4)), [sum(r) for r in [(1, 2), (3,)]])
- What is printed? python print(2 0.5 2 0.5, 2 0.5 2 0.5 == 2.0, round(2 0.5 2 0.5))