The correct option is D II > I > III
All the given molecules are 2,4 disubstituted anilines – whose basicity depends on the extent to which the electron density is available at the nitrogen of the −NH2 group at the ipso position. Alkyl groups are electron donating in nature and tend to augment the electron density of the conjugated system (via hyperconjugation). Chlorine group is deactivating in nature as it tends to reduce the density of electrons via inductive effect. Although each chlorine atom does have several lone pairs, there is hardly any conjugation into the benzene ring. The lack of conjugation is due to the difference in energies between the orbitals of carbon and chlorine (they belong to different periods).
The nitro group is even stronger in terms of its ability to withdraw electrons away from the benzene ring. So both chlorine and nitro are deactivating whereas the methyl group is the opposite. The −NH2 of 2,4-dinitroaniline will experience the least electron availability and it is the least basic. The −NH2 of 2,4-dimethylaniline will experience the highest electron availability and it is the most basic.
Hence, II > I > III