Open In App
Related Articles

ISRO | ISRO CS 2008 | Question 67

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report
Stack A has the entries a, b, c (with a on top). Stack B is empty. An entry popped out of stack A can be printed immediately or pushed to stack B. An entry popped out of the stack B can be only be printed. In this arrangement, which of the following permutations of a, b, c are not possible? (A) b a c (B) b c a (C) c a b (D) a b c

Answer: (C)

Explanation:
Option (A):
Pop a from stack A
Push a to stack B
Print b
Print a from stack B
Print c from stack A
Order = b a c

Option (B):
Pop a from stack A
Push a to stack B
Print b from stack A
Print c from stack A
Print a from stack A
Order = b c a

Option (C):
Pop a from stack A
Push a to stack B
Pop b from stack A
Push b to stack B
Print c from stack A
Now, printing a will not be possible.
So, option (C) is incorrect.

Quiz of this Question

Last Updated : 13 Jun, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads