Stack Exchange has multiple layers of security preventing this. Captchas and email addresses are required. The email check is easy to beat with a script, but the captchas aren't; you'd need a Captcha breaking service to even get this off the ground.
None of your bots can vote at the start, so you can't accumulate rep just by posting questions; human eyes have to look over your post and manually give you your first reputation. At best your bots could get rep only by other bots accepting answers. After each bot gets an accepted answer they would be able to upvote however.
Once they can upvote you start running into fraud detection; cross voting where a significant % of votes are split between two users are automatically flagged for moderator attention, and serial upvotes (more than a couple inside of a few minutes) would automatically be reversed, so you'd have to be VERY careful in how you implement this.
Even if you surpass the automated fraud detection, which would require significant effort and tools programmed specifically for the Stack Exchange Network, you run into the problem of human moderation. All posts on SE are getting human eyeballs on them. If your bots are asking duplicate questions, they're going to get closed. If they're asking gibberish or spam questions, they're going to get deleted, and deleted posts don't earn rep (certain outstanding circumstances aside).
Basically your bots would have to post actual, new, good questions in order to not be found out and shut down. SE has some okay automatic detection scripts here, but there's no way an army of bots would go unnoticed simply because you'd need an amazing artificial intelligence to actually write enough new questions and answers to pull this off.
Facebook hacking can be a lot easier because no one has to see your bot friends; Facebook profiles can go without human scrutiny, Stack Exchange posts cannot.
I'm not a Stack Exchange employee however, so there may well be additional security measures I'm unaware of, but as a user and moderator those are the significant points I'm aware of.