ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(hex(2**8 - 1), oct(2**9), bin(2**4))
- A. 0xff 0o1000 0b10000
- B. 0xff 0o512 0b10000
- C. 0xfe 0o1000 0b10000
- D. 0xff 0o1000 0b1111
Correct answer: A. 0xff 0o1000 0b10000
2**8 - 1 is 255, which is 0xff in hex. 2**9 is 512, which is 1000 in octal, and 2**4 is 10000 in binary.
More Python Programming questions
- What is printed? python print(str(0.5), str(0.25 + 0.125), 0.1 + 0.25)
- What is printed? python s = 'a,b;c' print(s.split(',;'), s.replace(';', ','), s.split(';'))
- What is printed? python print(max(range(5), key=lambda i: (i % 3, -i)))
- What is printed? python print(sum(x x for x in range(-3, 4)), sum(abs(x) for x in range(-3, 4)))
- What is printed? python print(2 0.5 2 0.5 == 2, round(2 0.5 2 0.5, 12) == 2)
- What is printed? python print(''.join(reversed('ab' 2)), 'ab'[::-1] 2 == 'baba')