Emerson Interview Question

How does a AND, OR and NAND gate operate?