GATE DA 2025 · Question 47 · Programming, Data Structures and Algorithms · Multiple choice (MCQ) · 2 marks · −2/3 for a wrong answer

Consider the following Python code snippet.
A={"this","that"} B={"that","other"} C={"other","this"} while "other" in C: if "this" in A: A,B,C=A-B,B-C,C-A if "that" in B: A,B,C=C|A,A|B,B|C
When the above program is executed, at the end, which of the following sets contains "this"?

  1. (A) Only A
  2. (B) Only B
  3. (C) Only C
  4. (D) A, C
Answer

Answer (B)

Answer from the official GATE DA 2025 answer key.

The step-by-step solution, where available, is part of GATE DA Pro. See what Pro includes