ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(int('zz', 36), format(1295, 'x'), int('1295', 10) == 1295, int('zz', 36) == 35 * 36 + 35)- A. 1295 51f True True
- B. 1295 50f False True
- C. 1205 50f True True
- D. 1295 50f True True
Correct answer: D. 1295 50f True True
Base 36 uses letters for digits 10 to 35, so 'zz' is 35 * 36 + 35 = 1295. In hex, 1295 is 0x50f, and the lower-case format gives 50f.
More Python Programming questions
- What is printed? python print([n for n in range(100, 1000) if sum(int(d) 3 for d in str(n)) == n])
- What is printed? python print(bin(37).count('1'), bin(37)[2:].count('0'), (37).bitlength() - bin(37).count('1'))
- What is printed? python x, count = 0b1011011, 0 while x: x &= x - 1 count += 1 print(count, bin(0b1011011).count('1'))
- What is printed? python def isanagram(a, b): return sorted(a) == sorted(b) print(isanagram('listen', 'silent'), isanagram('abc', 'abcc')…
- What is printed? python print(pow(3, 1018, 7), pow(3, 6, 7), pow(3, 1018 % 6, 7))
- What is printed? python print(sum(range(10)) / len(range(10)), sum(range(10)) // len(range(10)), sum(range(1, 11)) % 7)