The two-photon absorption (TPA) cross section and the second hyperpolarizability (gamma) of the linear quadrupolar molecule are theoretically investigated by using the ab initio calculation methods for a few series of quadrupolar molecules. The relationships between the molecular structure and the TPA as well as the NLO property are established. It is found that, as the strengths of donors and accepters increase, (i) both the energy gap between the first excited electronic state, \e>, and the ground electronic state, \g>, and that between the TPA-allowed excited electronic state \f> and \g> decrease, (ii) the energy gap difference, \E-fe - E-eg\, which is the detuning factor affecting the TPA matrix element, decreases, and (iii) the product of the transition dipole matrix elements, \mu (z)(fe)mu (z)(eg)\, associated with the TPA increases. These effects are combined to make the TPA cross section monotonically increase as the donor and acceptor strengths increase. The second hyperpolarizabilities of the same series of quadrupolar molecules are also calculated by using both the finite-field method and sum-over-state method. The relationship between the TPA and second hyperpolarizability is briefly discussed.