I) Resonance leads to a decrease in basic strength. In aniline, the lone pair electrons of N are in resonance with the benzene ring. Hence, the lone pairs are not easily available to donate, hence it has less basicity. II) Pyrrole is an aromatic compound, here also lone pair of electrons are involved in the aromaticity, hence it has the least basicity. III) In the given structure, N is bonded with 1 methyl and 2CH2 groups. Hence, due to the +I effect, it is the most basic compound among them all. IV ) In the given structure, N is attached with only one CH group, so it has less basic character than III. Therefore, the basic strength of given compounds is II < I < IV < III.