ProgrammingVery hardTCS NQT · Accenture
What is printed?
What is printed?
print(hex(255).upper(), int('FF', 16) == 0xff, '%X' % 255 == hex(255)[2:].upper(), oct(64))- A. 0XFF False True 0o100
- B. 0xFE True True 0o100
- C. 0XFF True False 0o64
- D. 0XFF True True 0o100
Correct answer: D. 0XFF True True 0o100
hex(255).upper() is 0XFF, and int('FF', 16) equals 0xff. %X and hex digits agree, and oct(64) is 0o100 because 64 is 8 squared.
More Python Programming questions
- What is printed? python print(0.1 + 0.2 != 0.3, 1 if 0.1 + 0.2 else 0, 0.0 or -0.0 or 'x', 0 and 1 or 2)
- What is printed? python print(len('u0301'), len('au0301'), 'au0301'.upper() == 'Au0301')
- What is printed? python words = 'the quick the lazy'.split() counts = {} for w in words: counts[w] = counts.get(w, 0) + 1 print(counts…
- What is printed? python print(sorted(['B', 'a', 'C'], key=str.casefold) == ['a', 'B', 'C'], sorted(['B', 'a', 'C']) == ['B', 'C', 'a']…
- What is printed? python print(int('1000') + int('01'), '1000'.replace('', '') == '1000', float('10.50'), '%.1f' % float('10.50'))
- What is printed? python print(round(-1234.5, -2), round(123456.0, -3), round(0.0, 2), round(1e-7, 7))