engineering recuitment NIC NIELIT Scientist B 2023 Mock Test Programming and Data Structure Stack Insertion
A program attempts to generate as many permutations as possible of the character p, q, r, s, t in the same order onto a stack, but it may pop off the top character at any time. Which of the following numbers can be generated using this program?
I. s, r, q, p, t
II. r, q, t, p, s
III. t, s, r, q, p
IV. s, r, t, q, p1
Only I and II
2
Only I, II and III
3
Only I, III and IV
4
Only III and IV