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)
  1. A. 256 7 1
  2. B. 256 6 7
  3. C. 256 7 7
  4. 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

Exams that ask this topic