Gradient LabSign up free

Home / GATE DA / 2025 / Q.47

GATE DA 2025, Q.47: Which sets contain "this" at the end

ProgrammingPython sets in a loop2 marksMCQ

The question

A = {"this", "that"}, B = {"that", "other"}, C = {"other", "this"}. While "other" is in C: if "this" in A, set A, B, C = A − B, B − C, C − A; if "that" in B, set A, B, C = C | A, A | B, B | C. At the end, which sets contain "this"?

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

Checking your access…

Source: official GATE DA 2025 question paper and answer key (IIT Roorkee). The question is lightly reworded; every number and option is kept.