GATE IT 2004 · Arrays & Matrix Representation

MCQ · 1 mark · Problem PROG-DSTR-0229

A program attempts to generate as many permutations as possible of the string, 'abcd' by pushing the characters a,b,c,d in the same order onto a stack, but it may pop off the top character at any time. Which one of the following strings CANNOT be generated using this program?
  1. A
    abcd
  2. B
    dcba
  3. C
    cbad
  4. D
    cabd

Solve it on GATE DA practice →More Basic Data Structures problems

Show the worked solutionOfficial GATE Answer Key: Option D.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/3695/gate2004-it-52

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com