to sum up,
2 strokes must have the exhaust on, or you will lean out too much and damage the engine, often beyond repair!
4 strokes exhaust pipe not that important but still wouldnt recomend not running without one.
Its all about back pressure, 2 stroke extremely important! 4 stroke not that much