Articles are used to indicate whether a noun in a sentence is specific or general. Ref grammarly.com
"a" is used for a general statement
I picked up a bottle of coke (any bottle).
"The" is used for specific items
The bottle was half full. (This particular bottle is half full).
If you make the sentence specific you must use "The"
"I answered the lecturer's question during the exam" only during is correct in this case
"The lecturer asked me questions in/during the exam." at/on are not correct
If you wish to use "a" you need to restructure the sentences
"I answered some questions that a lecturer asked me during an exam" only during is correct in this case (you did not know who the lecturer was and the sentence is non specific).
"A lecturer asked me some questions in/during an exam." at/on are not correct (you did not know who the lecturer was and the sentence is non specific).
In an exam, (part of the exam (test) that you are taking but not your reaction/answer to that exam (TEST)). Example; A question in an exam; "The lecturer asked me questions in the exam."
During an exam (something that happened or you did during an exam). Example; During the exam, I only managed to answer 18 questions; I answered the lecturer's question during the exam"
On; "The lecturer asked me questions on Napoleon during the exam." (on a subject)