The gas-phase proton affinities of selected beta-lactams, amides, cyclic and acyclic ketones, azetidine, and acyclic amines were measured by FTICRMS techniques. SCF and MP2 calculations at different levels of accuracy have been performed for the different neutral and protonated species, as well as a topological analysis of the electronic charge density. Our results, both experimental and theoretical, show that beta-lactams are weaker bases, in the gas phase, than acyclic amides. The attenuation of basicity upon cyclization of 2-azetidinone is stronger than that found for cyclic ketones of similar size due to the existence of a negative hyperconjugation effect. Our ab initio calculations indicate that both beta-lactams and acyclic amides are oxygen bases, but the gap between the oxygen and nitrogen intrinsic basicities is much smaller in the former due to the aforementioned cyclization effects. This is the result of charge redistributions due to the hybridization changes at the carbonyl carbon, which are very well described by a topological analysis of the corresponding electronic charge densities. On the contrary the cyclization effects on the gas-phase basicities of amines are almost negligible, and azetidine presents a gas-phase basicity practically equal to that of N-methylethanamine. Our topological analysis of bond activations of these species upon protonation reveals that for 2-azetidinone these effects are not dramatic when protonation takes place at the oxygen atom, whereas they are quite significant if protonation takes place at the ring nitrogen. Bond activations are also important in protonated azetidine and, in general, are slightly attenuated in the corresponding N-methyl derivatives.