Can a malicious WIFI network force a connection


Say I enter a place with public WIFI. Of course, I would not connect to the network since I know it’s risky, but I do have my computer turned on. Can an attacker know my computer is there and force a connection to it? If they would be able to do so, than my precaution is wasted, and any attacks a malicious network could do would be done.

Telling me whether this could be done and how to stop it would be very helpful, thanks.

As a sidenote, connecting to a known network may not be safe either, could hackers “replace” an existing network with a malicious network with the same name? If so, how to protect myself against it?