ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print('5' * 3 > '10' * 2, 5 * 3 > 10 * 2, '55' < '9', 55 < 9)- A. False False True False
- B. True True True False
- C. True False False False
- D. True False True False
Correct answer: D. True False True False
'555' is greater than '1010' because '5' is greater than '1' at the first character. Numerically 15 is not greater than 20, and '55' sorts before '9' as text.
More Python Programming questions
- What is printed? python print(float('inf') > 21000, -float('inf') < -(21000), float('inf') == float('inf') + 1)
- What is printed? python print(repr(0.1), repr(1 / 3), repr(2 / 3), repr(1e-7), repr(100.0))
- What is printed? python print(0.1 3 != 0.3, abs(0.1 3 - 0.3) < 2-52, abs(0.1 3 - 0.3) < 2-54)
- What is printed? python print(bin(255)[2:].rjust(10, '0'), int('0b' + '1' 8, 2) == 255, int('11111111', 2) + 0 == 255)
- What is printed? python s = 'hello world' print(s.count('o'), s.index('o', 5), s.title().split()[1][::-1])
- What is printed? python print(list(reversed(range(3))), list(range(3))[::-1] == list(reversed(range(3))), list(range(3, 0, -1)))