ProgrammingVery hardGATE CS · Product-company placement

What is printed?

What is printed?
print(3 * "ab" == "ab" * 3, [1] * 3 is [1] * 3, "%" in "100%", "100%%" % (), f"{{x}}")
  1. A. True True True 100%% {x}
  2. B. True False True 100% {x}
  3. C. True False True TypeError {x}
  4. D. False False True 100% {x}

Correct answer: B. True False True 100% {x}

Sequence repetition is commutative. Two separately built lists are different objects. In %-formatting '%%' produces one '%'; even with an empty tuple the format is processed. In an f-string, doubled braces print literal braces.

More Python Programming questions

Exams that ask this topic