GATE CS 2014 · Set-2 · Arrays & Matrix Representation

MCQ · 2 marks · Problem PROG-DSTR-0151

Suppose a stack implementation supports an instruction REVERSE, which reverses the order of elements on the stack, in addition to the PUSH and POP instructions. Which one of the following statements is TRUE with respect to this modified stack?
  1. A
    A queue cannot be implemented using this stack.
  2. B
    A queue can be implemented where ENQUEUE takes a single instruction and DEQUEUE takes a sequence of two instructions.
  3. C
    A queue can be implemented where ENQUEUE takes a sequence of three instructions and DEQUEUE takes a single instruction
  4. D
    A queue can be implemented where both ENQUEUE and DEQUEUE take a single instruction each.

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

Show the worked solutionOfficial GATE Answer Key: Option C.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/2007/gate2014-2-41

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