Hello,
To answer your question, what is 「何年生の時に、どんな学部で何を専攻したいか先生に聞かれましたか 」
in English?
I would say (in English):
"What year were you in, as a college student (university student), when your professor (teacher) asked you what subject (graduate course) you wanted to major in?
学部 specifically refers to college/university 'graduate course or department (area) of study'
So that's how (why) it translates into English in the above way.
Hope that helps.