It is generally believed that the student's GPA (grade point average) is highly correlated with his/her aptitude and IQ. Therefore, as you rightly state, learners' ranking in the class and their IQ may be positively correlated. In point of fact, this has been a reliable method of admitting students into different university programs abroad.