Among the compounds
the order of basicity is

From the KVPY 2009 · Streams SB/SX paper. Try it, check your answer, then read the worked solution below.
Among the compounds
the order of basicity is

Try it yourself first, then check your working against this.
Worked solution
I > III > II > IV.
(A)
Concepts used: basicity of heterocyclic amines, lone pair availability
Every past question tagged to the same part of the syllabus, with solutions.
All KVPY questions on Amines and Nitrogen Compounds · All KVPY questions on General Organic Chemistry
Past questions on the same topic (Amines), each with a worked solution.
Timed, in the real format, and marked the moment you submit.