The correct order of basicities of the following compounds is:
I>III>II>IV
Dimethylamine is more basic than ethylamine. The +I effect from the two methyl groups is slightly more pronounced than the +I effect from the lone ethyl group in ethylamine. Also, the amide is the least basic because the lone pair on the amide nitrogen is delocalized into the carbonyl. Lastly, Amidines are much more basic than amides and are among the strongest uncharged bases. Thus they are more basic than comparable amines too.
Also, should the compound get protonated, it usually gets protonated at the sp2 nitrogen.