Exercise definitely plays a role, but when it comes down to it, it's calories in vs. calories out. So yes, you could only eat junk food and still lose weight as long as you're burning more calories than you're consuming. You probably won't feel great though. Part of a "bad diet" is consuming too many calories. People will consume 5,000 calories, workout for an hour and say "I don't get it, I'm not losing weight". So even if you're diet isn't healthy and you lose weight by just adding exercise, you're simply burning more than you're consuming. All this also means it's possible to lose weight without doing any exercise simply by making sure you're burning more than you consume. While combining both a good diet and a good exercise routine is definitely the best approach and both are important, I think diet has a slightly higher importance than exercise.