Last you heard they were just over that hill over there, shambling their way across the desolated landscape. You and a bunch of survivors have found an Gun and Ammo shop whose owner is about to bug out as well but offers to sell you one firearm, whatever ammo he's willing to part with, and whatever random crap that's on the shelves that he's not taking. You have the cash to make whatever transaction you wish. The shop carries a decent selection of the more popular brands of firearms and there are still at least two or three boxes of ammo of just about every caliber left.
What do you take? Let's go over some of your options:
You could get yourself a shotgun, like this one. They'll do the job with one shot if you're within fifteen feet or so, but a shotgun that can hold five shells is considered high-capacity. The ammo is physically large, so you can only carry so much of it (you, my friend, are on your feet and your backpack holds all your possessions).
A high-powered rifle, like an AR-15, is a legitimate choice. Most high-cap magazines can hold a dozen or more rounds at a time, and you can take one down with one shot, usually (even though you should always double-tap, just in case).
You could get a handgun, like the M1911, which was US Army standard-issue for almost 75 years, and which is still in use today. Easy to carry, nice and compact, the clips carry a decent number of rounds. The larger ones have some good stopping power, but range is a factor and accuracy beyond 25 feet requires skill the average layperson doesn't have. Plus whereas compactness is nice, there's no point in concealment - everyone is either armed, already dead, or a zombie - so you're giving up a fair amount of power. Plus they're tougher to keep clean than a long firearm.
Or you could choose what I would choose: None of the Above. Because you're looking at it the complete wrong way if you're trying to determine your wisest course of action.
The reality is that the best gun in the world is rendered useless if you don't have any ammo. Real life isn't like a video game, where one magically comes across a glowing pile of ammo that magically fits your firearm every two minutes of gameplay. In real life, you tag a few goddamn zombies and you run out of ammo, and you hole yourself up in that barn over there and wait for the zombie horde to overtake you.
So you need to choose a firearm where the ammo is small, cheap, and plentiful. And nothing meets those three criteria better than .22 caliber long-rifle ammo. Your idiot friend who grabbed the AR-15 has to pay 20 bucks for a box of 20 rounds, if he can ever find a box of 5.56x45 ammo (doesn't it just roll off the lips?). So he takes a couple of boxes of ammo and his brilliant choice turns valueless in 40 shots.
Whereas that same twenty bucks buys 500 rounds of .22LR ammo, and every gun shop in the known universe stocks a dozen boxes of 500 ("bricks") for the delight of target-shooters, plinkers, and zombie-hunters everywhere. So whereas the AR-15 guy is fending off the horde by using his rifle as a bat, you are still armed and dangerous.
So we've determined that you should get a .22 rifle. Which one do you get? Well picture what life is like for you now. You're living a nomadic life, travelling from one lonely destination to another, keeping one step ahead of the zombies and scavenging the countryside and the partially-eaten bodies of those who came before you for what you need. You should get a rifle of which many thousands of specimens exist, that is easily customizable, for which spare parts exist in many places and are easily switched out.
For anyone who is a firearm enthusiast they already know which rifle I'm talking about: the Ruger 10/22 semi-automatic. Introduced in 1964 it represents the gold standard of small-caliber firearms. Because there are literally millions of them out there, accessories and spare parts like firing pins, ejector assemblies, etc. - stuff that will wear out over time - are carried in not only gun shops but just about every sporting-goods store, along with spare clips and boxes upon boxes of ammo. It's light, reliable, easy to clean, easy to carry, and deadly accurate. And sure, a .22 round doesn't have a lot of stopping power, but since you have so much of it and it's so cheap, you can put four in the zombie bastard's eye socket just like that - bap bap bap bap! - and drop that undead prick just as nice as you please.
The standard clip is 10 shots (and which, in a triumph of ergonomic design rarely seen in 1964, sits flush to the rifle when loaded, so that you can't see it), but one of those ubiquitous accessories I mentioned earlier that every gun shop would carry is a 25-round banana clip. I'd definitely grab a couple of those.
So there you go: At the gun shop scenario at the top of the page, for some pretty short money, I'd've armed myself with a Ruger 10/22. Best decision. I would have given the old guy who owned the shop $400 or so and walked away with one of the world's most reliable firearms, 2000 rounds of ammo, plenty of clips in case they come at me in numbers, and a decent shot at replenishing my supplies as I wander the apocalyptic remains of the U.S.A.
My idiot buddy who chose the AR-15 died an hour after the zombies came, by the way. I took his gold watch and a pound of beef jerky that he had. Hey: you do what you gotta do when the zombies come.