ProgrammingVery hardProduct-company MCQ pattern
What is printed?
What is printed?
import math print(math.comb(100, 50) % 1000, len(str(math.comb(100, 50))), math.perm(5, 2), math.comb(5, 7))
- A. 256 30 20 1
- B. 256 29 20 0
- C. 256 30 20 0
- D. 256 30 25 0
Correct answer: C. 256 30 20 0
comb(100, 50) has 30 digits, and it ends in 256 mod 1000. perm(5, 2) is 5 * 4 = 20, and comb returns 0 when k is larger than n.
More Python Programming questions
- What is printed? python import math print(math.floor(-0.5), math.ceil(-0.5), math.trunc(-0.5), math.floor(2.999999999999999999))
- What is printed? python print(f'{1234567.891:.2f}', f'{255:#x}', f'{5:03d}', f'{-5:03d}', f'{-5:+04d}')
- What is printed? python print(str(-0), int('-0'), -0.0 == 0, str(-0.0), 0 -1.0)
- What is printed? python print(str(1e21), str(1e15), str(123456789.123), 1e21 == 1021, float(1021) == 1e21)
- What is printed? python print(str(1e-5), 0.0001, 0.00001, 1e-4 == 0.0001, 10 -4)
- What is printed? python print(sorted(['10', '9', '2b', '2a']), sorted([10, 9, 2], key=str))