ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(int(str(12345)[::-1]) - 12345, 12345 - int(str(12345)[::-1]))
- A. 41975 -41975
- B. -41967 41976
- C. 41976 41967
- D. 41976 -41976
Correct answer: D. 41976 -41976
Reversing 12345 gives 54321, and 54321 minus 12345 is 41976. The second value is the negation of the first.
More Python Programming questions
- What is printed? python print(len(bin(-1)), len(hex(255)), oct(64))
- What is printed? python print(int('12abc', 16), int('ABC', 16) == 0xabc, int('1000000') == 106)
- What is printed? python print('%s' % None, '%r' % None, '%d' % True)
- What is printed? python print(str(3) 2 + str(3 2), int(str(3) 2) + 3 2)
- What is printed? python print(10 // 3 3 + 10 % 3 == 10, -10 // 3 3 + -10 % 3 == -10)
- What is printed? python print(sum(int(d) for d in str(320)) % 9, 320 % 9, (320) % 10)