Hi Aseema,
If you are talking about hide and show in dialog this article will give you the code snippet you can change accordingly
Toggle fields based on selection in Granite UI dialogs | Adobe AEM Club
If you are talking about the showing the data into Page,
1. You have the question and their link question either into the node or in the file as json formet.If questions is in the node make the json array based on the first question and inside another array of related second question.
2.Iterate through the json array and display the first level array question into selection box and rest of the thing in second selection is hide and show the related question using jQuery.