Answer
The printout of the given code is -
{1, 2, 3} {3, 4, 5} {1, 2, 3, 4, 5}
{1, 2, 3} {3, 4, 5} {1, 2}
{1, 2, 3} {3, 4, 5} {3}
{1, 2, 3} {3, 4, 5} {1, 2, 4, 5}
Work Step by Step
| operator provides the union of given sets so set3 becomes {1, 2, 3, 4, 5}
- operator provides the set difference of the given sets so set3 becomes {1, 2}
& operator provides the intersection of given sets so set3 becomes {3}
^ operator provides the set exclusive or of given sets set3 becomes {1, 2, 4, 5}