ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(int(str(7) * 3) ** 2 % 10, 111 ** 2, (11 ** 2) * 10 + 1)
- A. 1 12321 1211
- B. 9 12311 1211
- C. 9 12321 1221
- D. 9 12321 1211
Correct answer: D. 9 12321 1211
777 squared ends in 9 because 7 squared ends in 9. 111 squared is 12321, and 121 * 10 + 1 is 1211.
More Python Programming questions
- What is printed? python n = float('nan') print(n in [n], float('nan') in [n], n == n, [n] == [n])
- What is printed? python print(0.1 + 0.2 in [0.3], 0.3 in [0.1 + 0.2], round(0.1 + 0.2, 1) in [0.3])
- What is printed? python print(1 in {1.0: 'a'}, '1' in {1: 'a'}, 1.0 in {True: 1}, {1, True, 1.0})
- What is printed? python d = {} d[1.0] = 'x' d[1] = 'y' print(d, len(d), d[True])
- What is printed? python print(sorted(['b', 'a', 'c'], key=lambda s: -ord(s)))
- What is printed? python print(sorted([0.5, -0.5, 0, True, False], key=abs))