ProgrammingHardTCS NQT · Infosys

What is printed?

What is printed?
print('Hello, World'.swapcase(), 'hello world'.title(), "it's here".capitalize(), 'ABC'.isupper())
  1. A. hELLO, wORLD Hello World It's here True
  2. B. hELLO, wORLD Hello World It's here False
  3. C. Hello, Worlds Hello World It's here True
  4. D. hELLO, wORLD Hello World It's here Yes

Correct answer: A. hELLO, wORLD Hello World It's here True

swapcase flips each letter's case, title capitalises each word, and capitalize uppercases only the first character. isupper is True because the string has cased characters and none are lowercase.

More Python Programming questions

Exams that ask this topic