ProgrammingVery hardJEE Advanced · CAT placement
What is printed?
What is printed?
print(10 ** 50 // 3 ** 20 % 100, len(bin(10 ** 50)) - 2, (10 ** 50).bit_length())
- A. 61 167 167
- B. 61 166 167
- C. 60 167 167
- D. 61 167 166
Correct answer: A. 61 167 167
10**50 needs 167 bits, which both len(bin(...)) - 2 and bit_length() report. Floor division by 3**20 and % 100 are plain big-integer arithmetic, and the final two digits of the quotient are 61.
More Python Programming questions
- What is printed? python print(1 < 2 < 3 == 3.0 != 4, 1 < 2 > 3, (1 < 2) > 3, 'a' < 'b' < 'a')
- What is printed? python x = 0b1011 print(x & ~(1 << 1), x ^ (1 << 2), x | (1 << 4), (x >> 1) & 1)
- What is printed? python words = ['bb', 'a', 'ccc', 'aa'] print(sorted(words, key=lambda w: (-len(w), w)))
- What is printed? python pairs = [(1, 'b'), (1, 'a'), (0, 'c')] print(sorted(pairs, key=lambda p: p[0]), sorted(pairs))
- What is printed? python print(int('0b11', 0) + int('0o11', 0) + int('0x11', 0), int('11', 16), int('-0b11', 0))
- What is printed? python from math import inf print(inf - 1 == inf, 2 inf, -inf < -10 400, inf > 10 400)