ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(10 // 3 * 3 + 10 % 3 == 10, -10 // 3 * 3 + -10 % 3 == -10)
- A. True True
- B. True False
- C. False True
- D. False False
Correct answer: A. True True
The identity a == (a // b) * b + a % b holds for all signs in Python, so both checks are True.
More Python Programming questions
- What is printed? python print(sum(int(d) for d in str(320)) % 9, 320 % 9, (320) % 10)
- 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])