ProgrammingHardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(int('0x1A', 16), int('1A', 16), int('0x1A', 0))- A. 26 26 0
- B. 0 26 26
- C. 26 0 26
- D. 26 26 26
Correct answer: D. 26 26 26
int with base 16 accepts an optional 0x prefix, so both forms give 26. Base 0 reads the prefix to pick the base.
More Python Programming questions
- What is printed? python print(len(str(10 400 // 3)))
- What is printed? python print(1000000 == 10 6, 0x1F, 1e3 == 1000)
- What is printed? python print(oct(64), hex(-255), bin(0))
- What is printed? python print(ord('A') ^ 32, chr(ord('a') - 32))
- What is printed? python t = ([],) t[0].append(1) print(t, t[0] is t[0])
- What is printed? python print(list(dict.fromkeys('mississippi')))