ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(2 ** 0.5 * 2 ** 0.5, 2 ** 0.5 * 2 ** 0.5 == 2.0, round(2 ** 0.5 * 2 ** 0.5))
- A. 2.0000000000000004 True 2
- B. 2.0000000000000004 False 3
- C. 2.0000000000000004 False 2
- D. 2.0 True 2
Correct answer: C. 2.0000000000000004 False 2
The product is 2.0000000000000004, so it is not equal to 2.0 and the check is False. round gives the int 2.
More Python Programming questions
- What is printed? python print(min(map(str, [10, 9, 100])), sorted(['10', '9', '100']), sorted([10, 9, 100]))
- What is printed? python print(len([x for x in range(10) if x % 3 == 0]), sum(range(0, 10, 3)))
- What is printed? python x = [3, 1, 2] y = sorted(x) x.sort(reverse=True) print(x, y, x is y)
- What is printed? python print(list(map(sum, zip([1, 2], [3, 4]))), list(zip([[1, 2], [3, 4]])))
- What is printed? python print(10 // 3 3 + 10 % 3 == 10, -10 // 3 3 + -10 % 3 == -10, 10 // -3 -3 + 10 % -3 == 10)
- What is printed? python print(0 == False, '' == False, [] == False, None == False)