Cohomology rings of certain 4-periodic finite groups