ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(len(str(2 ** 64)), (2 ** 64).bit_length(), 2 ** 64 % 9, pow(2, 64, 9))
- A. 20 65 1 1
- B. 20 65 7 7
- C. 20 64 7 7
- D. 19 65 7 7
Correct answer: B. 20 65 7 7
2**64 = 18446744073709551616 has 20 digits. Its bit length is 65 because 2**64 is a single 1-bit at position 64. 2**64 mod 9 is 7, and pow with a modulus gives the same value.
More Python Programming questions
- Which technique gives the lowest total cost for answering q range-sum queries on a fixed Python list of length n, where n and q are both 2…
- What is printed? python x = 7 print(x // 2 if x % 2 else x / 2, x > 3 > 2, not x > 3 == 4)
- What is printed? python print(pow(-2, 3, 5), pow(3, -1, 7), pow(2, 10, -7), (-2) 3 % 5)
- What is printed? python try: s = str(10 4301) print(len(s)) except ValueError: print('too many digits')
- What is printed? python print(' xt'.strip() == 'x', 'atb'.expandtabs(4), len('atb'.expandtabs(4)), 'abrncd'.splitlines())
- What is printed? python print('²'.isdigit(), '²'.isdecimal(), '²'.isnumeric(), '٥'.isdecimal())