ProgrammingVery hardProduct-company MCQ pattern
What is printed?
What is printed?
print(sum(int(d) for d in str(3**20)) % 9, 3**20 % 9, (3**20) % 10)
- A. 0 0 9
- B. 0 0 1
- C. 1 0 1
- D. 0 1 1
Correct answer: B. 0 0 1
A number and its digit sum agree modulo 9, and 3 to the power 20 is divisible by 9, so both remainders are 0. The last digit of 3**20 is 1.
More Python Programming questions
- What is printed? python print(len(str(1050 + 1).rstrip('0')), str(1050 + 1)[-2:], str(1050 - 1)[:3])
- What is printed? python print(max(map(len, ['abc', 'de', 'fghi'])), list(map(len, ['abc', '', 'x'])), sum(map(len, ['ab', 'cd'])))
- What is printed? python print(float('1e-3') 1000 == 1, int(float('1e-3') 1000), round(float('1e-3') 1000))
- What is printed? python print(len({'a': 1, 'b': 2}), len({'a', 'a', 'b'}), len(dict.fromkeys('hello')))
- What is printed? python print(sorted({'b': 2, 'a': 3}.items(), key=lambda kv: kv[1])[0][0], list({'b': 2, 'a': 3})[-1])
- What is printed? python print(3 3 0, (3 3) 0, 0 3 0, (0 3) 0)