The compound (I) does not have pi electrons necessary for delocalisation of the ring and the diazotisation to occur easily. Compound (II) readily undergoes diazotisation, while compound (III) contains clectron donating group, which will increase the density on the phenyl ring, thereby destabilising the positive charge on the phenyl ring, thereby activating the ring towards nucloophilic substitution reaction. As the group is present in the meta position it wouldn't destabilise the positive charge to a large extent, thus diazotisation will occur, albeit at a slower rate. On the other hand, compound (IV) has electron withdrawing group which will stabilise the positive charge on the phenyl ring, thereby deactivating the ring towards nucleophilic substitution reaction.