ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
print(pow(0, 0), 0 ** 0 == 1, pow(2, -2, 5), pow(0, 0, 5))
- A. 1 True 4 1
- B. 1 True 2 0
- C. 0 True 4 1
- D. 1 False 4 1
Correct answer: A. 1 True 4 1
Any number to the power 0 is 1, including 0 ** 0. pow(2, -2, 5) is the inverse of 4 mod 5, which is 4 since 4 * 4 = 16 is 1 mod 5. pow(0, 0, 5) is 1.
More Python Programming questions
- What is printed? python import math print(0.0 == -0.0, 1 / float('-inf'), 2 -1074 / 2 == 0, math.copysign(0.0, -1))
- What is printed? python try: print(int('')) except ValueError: print('empty') try: print(0.0 / 0) except ZeroDivisionError: print('zero')
- What is printed? python import math try: print(math.sqrt(-1)) except ValueError: print('domain') print(float('nan') 0, math.pow(0, 0))
- What is printed? python print('{:e}'.format(1234.5), '{:.3g}'.format(1234567), '{:g}'.format(0.0001), '{:g}'.format(0.00001))
- What is printed? python print('é'.encode('ascii', 'replace'), 'é'.encode('ascii', 'ignore'), b'hxc3xa9llo'.decode('ascii', 'ignore')…
- What is printed? python print(10 50 // 3 20 % 100, len(bin(10 50)) - 2, (10 50).bitlength())