ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
print(1 < 2 < 3 < 4 == 4.0, 4 == 4.0 != 5, 1 < 3 > 2 < 2)
- A. True False True
- B. False True False
- C. True True False
- D. True True True
Correct answer: C. True True False
Each chained comparison checks adjacent pairs, so the first two are True. The last needs 2 < 2, which is False.
More Python Programming questions
- What is printed? python print(oct(0o17 + 0b11), 0x10 | 0o7, 10 + 0x1)
- What is printed? python print('x'.center(4, '-') + '|', '7'.zfill(3) + '|', '-7'.zfill(4))
- What is printed? python print(max(3, 3.5, 2), min('b', 'a', 'c'), max([1, 2], [1, 3]))
- What is printed? python print(len(str(9 20)), str(9 20)[0], sum(map(int, str(9 20))) % 9)
- What is printed? python from fractions import Fraction print(Fraction('1.5'), Fraction('3/6'), float(Fraction('1/3')) == 1/3…
- What is printed? python print(sum([[1, 2], [3]], []), ''.join(['ab', 'c']), [x for x in 'hey'][::2])