The task of lexical analyser is just to identify tokens that is validated using the DFA used for lexical analyser.In addition it ignores white spaces , tabs , comments if any.So if a token is following the pattern which is indicated by the regular expression used for the dfa of the lexical analyser.
So the token "nit" will be considered as a valid token as far as the lexical analyser since it cannot check any attribute of a token for example address for the identifier , type of the identifier(int , float)etc.
Only errors like improper format of variable name like 1_abcd is a lexical error since we know a variable name cannot start with a digit according to the constraint mentioned in the regular expression of lexical analyser being used.
It is in the semantic analysis phase that it comes to know that 'a' , 'b' has been treated like variable but defined to be 'int'.So error message is displayed :
a , b undeclared along with line number in which a and b are used.
So the error in the given code is a semantic error only.
Hence the correct option is C)