Let's look at interfacing a Hex keypad, the one with 16 switches; arranged in 4 columns and 4 rows. The interesting challenge is to interface 16 switches on 8 pins. So how does this work? The simple answer is the MCU is faster than the your fingers.