In theory, if you ran 10 miles a day, then it probably wouldn't matter what you ate since all that exercise would burn off whatever you consumed. It still wouldn't be a great idea to spike your blood sugar levels with crappy food, but that's another matter.
Actually, even if you didn't exercise, you would lose weight if you ate nothing but cupcakes and candy for an entire month. The reason you'd lose weight is your body would be malnourished and you'd get sick and weak pretty quickly. Not exactly the scenario you're looking for.
Curiousone is right about the oils. McDonalds, BK, Hooters, etc...those restaurants all use the cheapest oils they can find to make their food, and it can do a lot of damage to your body. Some restaurants are actually good about this, though.
A lot of people try to follow goofy diets, count calories, etc. I follow a simple rule: the less "processed" a food is, the better it is for you. Fresh fruits and vegetables are great since they are essentially untouched and straight from the earth. On the other hand, think about how many times over a frozen dinner has been processed (ie how many chemicals have been added to it) from the time it is made to the time it gets to your oven...