Shouldn’t this be “When did you take the exam?” or “When did you sit the exam?” ?
The set of sentences on Tatoeba is quite confusing, as there are sentences in German with abgelegt and bestanden, and in English with pass and take. https://tatoeba.org/en/sentences/show/1387158
That’s difficult.
“Wann haben Sie die Prüfung abgelegt?” (Vergangenheit!) implies a positive result but it is not as clear cut as “Wann haben Sie die Prüfung bestanden?”
Otherwise one would say:
“Wann haben Sie die Prüfung geschrieben?”
or more formal
“Wann sind Sie zur Prüfung angetreten?”
Literally “ablegen” means “lay aside” or “put away”.