ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
from math import isqrt print(isqrt(10**30), isqrt(99), isqrt(10**30 - 1))
- A. 1000000000000000 10 999999999999999
- B. 1000000000000000 9 1000000000000000
- C. 999999999999999 9 999999999999999
- D. 1000000000000000 9 999999999999999
Correct answer: D. 1000000000000000 9 999999999999999
isqrt returns the floor of the exact square root. The square root of 10**30 is 10**15 exactly, while 10**30 - 1 falls just below it, and isqrt(99) is 9.
More Python Programming questions
- What is printed? python print(sum(1 for in range(105) if '7' in str()), len(str(sum(1 for in range(105) if '7' in str()))))
- What is printed? python print('%s' % (1,), '%s' % ((1,),), '%r' % ((1, 2),))
- What is printed? python print(1 if True else 0 or 2, not 0 or 3, (not 0) or 3, 0 or '' or None)
- What is printed? python print(max(map(str, [9, 10, 2])), max([9, 10, 2]), min(map(int, ['10', '9'])))
- What is printed? python x = 0.1 3 y = 0.3 print(x == y, abs(x - y) < 1e-15, round(x, 15) == round(y, 15), x - y)
- What is printed? python print('ß'.isupper(), 'Dž'.istitle(), 'Dž'.isupper(), '1A'.isupper())