ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
print('x' * 0 == '', 'Z' < 'a', '10' < '9', 'apple' < 'Apple')- A. True False True True
- B. True True True True
- C. True True True False
- D. True True False False
Correct answer: C. True True True False
Strings compare by code point, so 'Z' (90) is less than 'a' (97) and '10' is less than '9' because '1' comes before '9'. Lowercase 'a' (97) is greater than capital 'A' (65), so 'apple' is not less than 'Apple'.
More Python Programming questions
- What is printed? python print(len('eu0301'), 'é' == 'eu0301')
- What is printed? python print(0b1010 & ~0b10, 0b1010 ^ 0b1111, 1 << 3 | 1, 6 & 3 == 2)
- What is printed? python print(1 << 100 >> 99) try: print(1 >> -1) except ValueError as e: print(e)
- What is printed? python print(len(str(21000)), sum(map(int, str(21000))))
- What is printed? python print(1018 10 // 1018 == 10, type(1018 / 1018))
- What is printed? python print(round(1.005, 2), round(0.285, 2), round(1.45, 1))