Sitting for extended periods can cause the catalytic converter to become less efficient and produce higher emissions than normal. Driving the vehicle for 30-40 miles allows the engine to warm up completely and the catalytic converter to function at its peak, giving a more accurate reading during the smog test. The goal is to get a representative reading of the emissions under typical driving conditions, not a "cold start" reading.