A study of electronuclear sum rules in light and medium-weight nuclei