It's illegal for the dealership to check your credit without getting prior permission, but this doesn't mean that they won't try.
Why would they want to check your credit? To see which loans you would qualify for and to get you set up into a loan in case you decide you like the car, in hopes that you wouldn't go looking at other places for a cheaper loan.
Speaking of loans, if you need a car loan be sure to check your credit union for rates before buying a car. Don't belong to a credit union? Join one.
www.pendfed.com is an example of one you can join.