ProgrammingHardJEE Advanced · CAT placement
What is printed?
What is printed?
import math print(math.comb(100, 50) % 1000, 2**100 % 9, sum(map(int, str(2**100))) % 9)
- A. 256 7 1
- B. 256 6 7
- C. 256 7 7
- D. 250 7 7
Correct answer: C. 256 7 7
The last 3 digits of C(100, 50) are 256. 2 has order 6 mod 9, so 2**100 is 2**4 = 16, which is 7 mod 9. A number and its digit sum agree mod 9, so the digit-sum check also gives 7.
More Python Programming questions
- What is printed? python print(5e-324 / 2 == 0, 2e-323 > 5e-324, float('1e-400'), 5e-324 / 2 == 0.0)
- What is printed? python import math print(int(-0.5), int(-1.9), math.floor(-1.1), round(-1.5))
- What is printed? python print(7 & -8, 7 | -8, 7 ^ -8, ~7 & 0xFF)
- What is printed? python print(float(' 1000.5 '), float('infinity') > 1e308, float('-nan') != float('-nan'), int(' +0012 '))
- What is printed? python print(b'abc'[0], bytes([65, 66]), bytes.fromhex('41 42'), len(b'a' 2 + b'x00'))
- What is printed? python print(sorted(['b', 'A', 'c', 'B'], key=str.casefold, reverse=True))