ProgrammingHardProduct-company MCQ pattern
What is printed?
What is printed?
print(int('١٢٣'), int('0' * 2 + '5'), int('5' + '0' * 2), int(' \t7\n'))- A. 123 5 50 7
- B. 123 0 500 7
- C. 12 5 500 7
- D. 123 5 500 7
Correct answer: D. 123 5 500 7
int() accepts Unicode decimal digits, so Arabic-Indic digits 1 2 3 give 123. Leading zeros are fine in a string passed to int(), and surrounding whitespace, including tabs and newlines, is stripped.
More Python Programming questions
- What is printed? python print(bin(-8 & 0xFF), (-8) >> 1, (-8) // 2, (-9) // 2, -9 >> 1)
- What is printed? python print(x := 7, x 2, [y := 3, y + 1])
- What is printed? python print('%s|%r' % ("it's", "it's"))
- What is printed? python print(ord('a') - ord('A'), chr(ord('A') + 32), 'Z'.lower() < 'a', 'z' > 'Z')
- What is printed? python print('-'.join('abc'), ''.join(map(str, [1, 2, 3])) == '123', ','.join([]) == '', 'x'.join(['', '']))
- What is printed? python s = 'hello' print(s.find('l'), s.index('l', 3), s.rfind('l'), s.count('ll'), s.find('z'))