In the Transformers film, Ratchet and Bumblebee noticed that the F22 was not a friendly and instead, was Starscream. Can all Transformers detect other Transformers even if they are in their alt-modes?
As far as we know, no. Although if they're observant they may notice details, like Decepticon badges other non-Earth details or things out of place, such as "TO PUNISH AND ENSLAVE" instead of "TO PROTECT AND SERVE" on the side of the police vehicle.
In Dark of the Moon we see that the N.E.S.T. base has energon detectors installed, to alert them of incoming Transformers, especially Decepticons. This helps illustrate that the Autobots being present, on their own, was not enough of a warning. It's not clear evidence, but it's just another piece of the world that adds up to alt mode being effective camouflage to other Cybertronians.