How does Sentinel Prime have an earth based ALT-mode even when he had crashed on the moon ? The Autobots find him in the exact same state. So my question is how could he have an earth based ALT-mode even before he had ever visited earth?
Since you mention the moon, I assume you're referring to Sentinel Prime in the film "Transformers 3: Dark Side of the Moon" (there have been numerous characters named Sentinel Prime throughout the various continuities).
Spoilers, just in case
In the Michael Bay universe, a Transformer only requires a few seconds to scan & imitate a vehicle. When Sentinel is first found and then later awakened, we see only his robot form. Later, when we first see his vehicle form (a red fire truck), he has been on Earth for at least two days - possibly longer - while working with The Autobots and NEST. Since the fire truck form he uses is of a military variety, we can safely assume that Sentinel scanned one of the NEST emergency response vehicles to use as a disguise, an event which occurred off-screen during the timeframe in which Sam & Seymour attempt to crack the mystery surrounding the moon landing.