"What grade are you in?"
Help!! I always make these mistakes. I've found that soemtimes 何comes before or after some words in a sentence but what's the rule for it? Is 年生何ですか? Wrong
yes, it is wrong.
何年生（なんねんせい）ですか? ask about grade of school.
何才（なんさい）ですか? ask about age.
何時（なんじ）ですか? ask about time.
i hope this helps!
何個（なんこ） how many (small rigid shape objects)
何本（なんぼん） how many (long rod shaped objects)
何度（なんど） how many (times/degrees)
Wait so it seems that 生 is "せい." Why is it pronounced "なま" when its block is selected?
Japanese kanji almost always have multiple pronunciations (often grouped into on'yomi/Chinese-derived pronunciations and kun'yomi/Sino-Japanese derived pronunciations) and which one is correct depends heavily on the context in which the character is used.
So, in the context of 「年生」, 生 should be pronounced せい. However, in the context of 「生」on its own, it should be pronounced なま. It's giving you the correct pronunciation but Duo's TTS program falls down for new learners because they haven't configured it correctly.
Please tell me if i have this right: 何年 modifies 生 so that the whole expression 何年生 is a noun that refers to a student of unknown grade?
年生 is not a noun. It is a suffix. So it cannot be used like that.
I can't think of a way of saying it better than （あなたは）何年生ですか。 Technically it can be （あなたの）学年（がくねん）は何年ですか but I really haven't heard people saying this.
I'm surprised that "ni" is not used to represent "in" for "What grade are you in". As in: "nannensei ni desuka", or something like that.
Can this sentence be used in the context of martial arts student to ask about the grade? Like in kendo?
No, 何段ですか is more appropriate.
I just came across a piece of text from the current book I am reading - Fromりゅうおうのおしごと! (GA文庫) 第三譜 連盟道場