komal see here
for option a) sequence is...
POP A(stack)///////it will pop 'a' as it is on top
PUSH B(stack) /////// it will push 'a' into stack B
POP A //////it will pop 'b' as it is on top
print .....it will print 'b'///////as POP from stack A can be printed immediately
POP B
print/////// it will print 'a'
POP A
print it will print 'c.....so we get 'bac' as permuatation...
option (b) similarly POP A, PUSH B,POP A,print////b,POP A,print////c, POP B,print///a........bca
option(d) POP A,print///a, POP A,print///b, POP A,print///c.........abc printed
option(c)....this sequence is not possible...bcoz to print 'c' u need to pop first 'a' then insert inside stack B and again..pop A...and insert inside STACK B..then u can print 'c'.. but...now u cannot..print 'a' ..coz 'b' is on top in STACK B..and in STACK B if u pop u have print it neccessarily...so 'b' has to printed..first..then only u can print 'a'....cab...not possible