ProgrammingModerateTCS NQT · Wipro pattern
What is printed?
What is printed?
print(3 > 2 > 1, 3 > 2 and 2 > 1, (3 > 2) + (2 > 1))
- A. True True 2
- B. True False 2
- C. False True 1
- D. True True 1
Correct answer: A. True True 2
The chain 3 > 2 > 1 means both comparisons hold. Booleans add as integers, so True + True is 2.
More Python Programming questions
- What is printed? python print(sorted([0.5, 1, True, False]), max(0.5, 1, True))
- What is printed? python print('%s|%s' % ('a', 'b'), 'ok', '%5.1f%%' % 99.55)
- What is printed? python print(len(set('aabbcc')), sorted(set('cba')), 'abc'.index('b') + 'abc'.count('b'))
- What is printed? python print(1000000 1000000 == 1012, 0.1 0.1 100 == 1, round(0.1 0.1 100, 10) == 1.0, 2 0.5 == 2 (1 / 2))
- What is printed? python print(sum(range(0, 101, 5)), len(range(0, 101, 5)))
- What is printed? python print(bin(37)[2:].zfill(8), int('100101', 2) == 37)