Default digital/analog pin state - input or output? (do unused pins need to be grounded to prevent floating inputs)

So it sounds like the best solution is either manually define all unused pins as inputs and connect them to 5v or ground via resistor, or set as output and leave unconnected. Correct?