ProgrammingHardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(bin(37)[2:].zfill(8), int('100101', 2) == 37)- A. 00100110 True
- B. 00100101 True
- C. 100101 True
- D. 00100101 False
Correct answer: B. 00100101 True
37 is 100101 in binary. zfill pads the digits to eight places, and parsing 100101 in base 2 gives back 37.
More Python Programming questions
- What is printed? python import heapq h = [] for x in [5, 2, 8]: heapq.heappush(h, x) print(heapq.heappop(h), heapq.heappop(h), h)
- What is printed? python print(sorted([3, 1, 2], key=lambda x: -x)[0], max([3, 1, 2], key=lambda x: -x))
- What is printed? python print([x for x in range(20) if x % 3 == 0 and x % 4 == 0])
- What is printed? python print(len({(i, j) for i in range(3) for j in range(3) if i <= j}))
- What is printed? python print(sum(1 for c in 'Hello World' if c.isupper()), 'Hello World'.count('o'))
- What is printed? python print(float('1e400'), -float('1e400'))