In any experiment, you can define the independent variable (or variables) as any factor that is considered to affect directly the object of study, and the dependent variable is the effect observed.
In this scenario, the professor thinks that the place where the students study affects the result of their exams.
Out of these two variables "the result in the exam" is the observed effect, and thus, the dependent variable and the "location where the student studies" is the factor that affects it, therefore it is the independent variable.