Is there a specific word for a dialogue between two characters in a play or novel, where that dialogue only consists of questions and answers?
There is no non-technical word for this. But the situation can be simply described
A dialogue where one person asks and the other answers.
A particular scene may describe various types of question-answer dialogues [note how, having established context the phrase "question-answer dialogue" is now clear] for example an "interview" or a "Socratic dialogue". You may find that one of these more precise terms suits your needs better.
Stichomythia is the technical term for an extended dramatic passage in which two characters speak alternating lines of verse. There's also hemistichomythia, in which the characters alternate half-lines and distichomythia, in which they alternate couplets.
The device was fairly common in classical Greek tragedy, and Renaissance playwrights often adopted it. The term is often extended to rapid-fire alternation in prose, such as Abbot & Costello's famous Who's on first routine:
Abbott: Strange as it may seem, they give ball players nowadays very peculiar names.
Costello: Funny names?
Abbott: Nicknames, nicknames. Now, on the St. Louis team we have Who's on first, What's on second, I Don't Know is on third—
Costello: That's what I want to find out. I want you to tell me the names of the fellows on the St. Louis team.
Abbott: I'm telling you. Who's on first, What's on second, I Don't Know is on third--
Costello: You know the fellows' names?
Costello: Well, then who's playing first?
Costello: I mean the fellow's name on first base.
Costello: The fellow playin' first base.
Costello: The guy on first base.
Abbott: Who is on first.
Costello: Well, what are you askin' me for?
Abbott: I'm not asking you—I'm telling you. Who is on first.
Costello: I'm asking you—who's on first?
Abbott: That's the man's name.
Costello: That's who's name?
The device is not restricted to Q&A situations, but of course it's admirably suited to them.