GATE Assistant

Past questions › Data Science and Artificial Intelligence › GATE 2025

GATE 2025 · DA · MCQ · 2 marks · Programming, Data Structures and Algorithms › Python Programming

GATE 2025 Data Science and Artificial Intelligence question: Consider the following Python code snippet. code When the above program is executed, at…

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

Show answer

This question is in an all-India live mock that is open now. Its answer appears here when the mock closes.

Practise this question with exam-style marking