1) 509mm / 20 inches
2) 363mm / 14.5 inches
3) 300mm / 10.5 inches
4) Varies depending on the type of gun.
In airsoft, a longer barrel doesn't necessarily translate into better range or accuracy. More important than barrel length is the consistency of the gun (air seal), and your hop-up unit, bucking and nub. A 300mm barrel can easily out perform a 509mm barrel if you have a superior hop-up and air seal. The difference between the two lengths would be very small (if any at all) all other things being equal.
An M4 is a good platform to build from. You will have countless options and guides available because it's by far the most popular gun in use.
It's hard to give any advice beyond that without a budget in mind.