1. Does the dialogue make sense? Yes, "B. Did he...No" is the only answer that works. To me, the first speaker means 'I don't suppose he would have done well in the midterm exam last week even if he had worked hard enough/harder before the exam'. Am I right? More to the point, the speaker, by the statement, appears to acknowledge a history of past performance(s) -- regardless of any particular effort for this exam -- and assumes a likewise outcome.
2. 'He almost failed the exam' means 'He only narrowly passed the exam'. Is that so? Yes.
3. Do you native speakers ever use a tag question after the 'would have done' structure, and if so, what tag do you use? The tag question, "Did he?" would be typical for native speakers. Here the speaker is postulating an outcome based upon past performance. The tag question, "Did he?" simply asks for confirmation of what has been postulated (which, given exceptional and unexpected circumstances, might not be correct).
Student or Learner