ProgrammingModerateTCS NQT · Wipro pattern
What is printed?
What is printed?
print('%d%%' % 50, '%x' % 255, '%o' % 8, '%e' % 12345.678)- A. 50% ff 10 1.2346e+04
- B. 50% ff 10 1.234568e+04
- C. 50% ff 8 1.234568e+04
- D. 50% ff 10 1.234568e+4
Correct answer: B. 50% ff 10 1.234568e+04
%% prints one percent sign, %x gives lowercase hexadecimal, and %o gives octal, so 8 is 10 in base 8. The %e default has six digits after the point, which gives 1.234568e+04.
More Python Programming questions
- What is printed? python print(-(264) >> 3, -(264) // 8, -(264) % 10)
- What is printed? python print('a,b,,c'.split(','), 'a b c'.split(), 'a b c'.split(' '), ' x '.strip(), 'x,'.split(','))
- What is printed? python print(sorted(['Bb', 'aA', 'bb', 'AA'], key=str.lower))
- What is printed? python print(-7 % 3, 7 % -3, -7 // 3, 7 // -3)
- What is printed? python print(pow(-7, 3, 5), (-7) 2 % 5, -7 2 % 5)
- What is printed? python print(2100 % 7, pow(2, 100, 7), pow(2, 100, 1))