Conceptually, you’d need to do the following (in a hypothetical, non-existing language):
R=Random(0 or 1)
IF (R==0) A=ASK("Q1")
B=ASK("Q2")
IF (R==1) C=ASK("Q1")
Z=(R==0)?A:C
You will have to include two copies of the question Q1 - in all possible places where they may appear, then put conditions (must be mutually exclusive) to show only once. Lastly you wrap the answer to a variable to have that named the same Z, regardless when it was asked, and you can subsequently drop A and C in the exported data. This is possible for all questions which can be represented with a variable (e.g. text, numeric, date, etc), but not for images, for example, there you remain with A and C of which only one is populated, then process the data after the export. Hope this helps.