How long can e-coli survive outside the body, on a apple or a banana?

Indefinitely. If everything in the world were to disappear except for the bacteria, we'd still see the outlines of almost everything. We pathologists wash our hands often. A minority of bacteria are nasty (most e. Coli are harmless / helpful), so it's always a good idea to wash fruit if you'll eat the surface.