In the US, we ask students in high school or below (especially below high school) "What grade are you in?" Elementary-age students would likely answer, "2017," to a question like "What year are you in?" Although if "2017" is the answer you are looking for, then the more natural way to ask the question is, "What year is it?"
For university and above, "What year are you in?" works, or even, more informally, "What year are you?" The answer to these questions can be "second year," or "junior year," etc.