ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
print(int('10', 36) == 36, int('Z', 36), int('z', 36) + 1, int('10', 2) == 2)- A. False 35 36 True
- B. True 36 36 True
- C. True 35 35 False
- D. True 35 36 True
Correct answer: D. True 35 36 True
'10' in base 36 is 36, and Z or z is 35 in base 36, so adding 1 gives 36. '10' in base 2 is 2.
More Python Programming questions
- What is printed? python x = [1, 2, 3] print(x.pop(), x.pop(0), x, x.insert(0, 9) or x)
- What is printed? python print(max(map(len, ['a', 'bbb', 'cc'])), min(len(s) for s in ['a', 'bbb']), sum(len(s) for s in ['ab', 'c']))
- What is printed? python print(float('1e2') == 100, int(float('1e2')), str(float('1e2')), int('100'))
- What is printed? python print(round(1.0000000000000002, 15) == 1, 1.0000000000000002 == 1, 1.0000000000000002 - 1 == 2.220446049250313e-16)
- What is printed? python s = 'hello world' print(s.title().split()[1][::-1], s.rsplit(' ', 1)[0], s.count('o', 5))
- What is printed? python print(int(0.1 10), round(0.1 10, 10) == 1, 0.1 10 == 1)