ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(int('0' + '9' * 3) + 1, int('9' * 3 + '0') + 1)- A. 1000 9991
- B. 999 9991
- C. 1000 9990
- D. 1000 1000
Correct answer: A. 1000 9991
A leading zero does not change the value, so '0999' is 999 and adding one gives 1000. Appending a zero multiplies by ten, giving 9990, and the extra one makes 9991.
More Python Programming questions
- What is printed? python print(7 // 0.5, 7 % 0.5, -7 // 0.5)
- What is printed? python print(0.5 1074 == 0, 5e-324 > 0, 5e-324 / 2 == 0)
- What is printed? python print('abcabc'.replace('abc', 'x', 1), 'aaaa'.replace('aa', 'b'), 'aaa'.replace('', '-'))
- What is printed? python print('Mississippi'.lower().count('s'), 'Mississippi'.find('ss'), 'Mississippi'.rfind('ss'))
- What is printed? python print(float('-0') == 0.0, str(float('-0')), str(float('+0')))
- What is printed? python print(sum(1 for i in range(1, 1001) if '7' in str(i)))