It's correct both in British English https://www.lexico.com/en/definition/ma%27am and American English https://www.merriam-webster.com/dictionary/ma%27am
But incorrect in the actual living language imho. No native English speaker conceives of "ma'am" as two words, regardless of the archaic origin.
I believe the question was, are "ma" and "'am" two separate words. The answer is no, they are not. Ma'am is a single word.
I thought the student was asking the professor if she had a doctorate. But not so: this is someone asking a lady if she is a doctor, correct? For example addressing a lady in a lab coat at a hospital whom one has not yet met.
Both meanings are correct, though the question is more likely to be asking about her being a medical doctor rather than a professor.
The choices that were given in English didn't match the meaning of this sentence. The word "ma" in English is a slang term for mother and did not register in my mind as a shortened form for "ma'am." I understood the sentence but could not translate it properly given the choices.