In both genders,performance on Mathematics was found to be the best predictor in programming ability,followed by performance on a spatial test.
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.110...