What is the difference between a pull-up and a pull-down resistor, and how do they prevent floating states on GPIO pins?