A 2:1 multiplexer with the inputs connected in a specific way can act as an Ex-OR gate. When A is used as the selector and the inputs D0 and D1 are connected to A and B respectively, the output of the multiplexer will produce the Ex-OR operation between A and B.