ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print('%s' % None, '%r' % None, '%d' % True)- A. None None True
- B. None 'None' 2
- C. None None 1
- D. None None 0
Correct answer: C. None None 1
%s and %r both show None for the None object here, while %d converts True to the int 1.
More Python Programming questions
- 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)
- 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))