McqMate

Q. |
## Suppose 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? |

A. | a queue cannot be implemented using this stack. |

B. | a queue can be implemented where enqueue takes a single instruction and dequeue takes a sequence of two instructions. |

C. | a queue can be implemented where enqueue takes a sequence of three instructions and dequeue takes a single instruction. |

D. | a queue can be implemented where both enqueue and dequeue take a single instruction each. |

Answer» C. a queue can be implemented where enqueue takes a sequence of three instructions and dequeue takes a single instruction. |

2.4k

0

Do you find this helpful?

24

View all MCQs in

Data Structures (DS)No comments yet

- In stack terminology, the __________operations are known as push and pop operations respectively.
- Inserting an item into the stack when stack is not full is called …………. Operation and deletion of item form the stack, when stack is not empty is called ………..operation.
- Pushing an element into stack already having five elements and stack size of 5, then stack becomes
- The term "push" and "pop" is related to the
- The term push and pop is related to
- When a stack is organized as an array, a variable named Top is used to point to the top element of the stack. Initially, the value of Top is set to_______to indicate an empty stack.
- Consider the usual algorithm for determining whether a sequence of parentheses is balanced. Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right parentheses (in some order). The maximum number of parentheses that appear on the stack AT ANY ONE TIME during the computation?
- Suppose you are given an implementation of a queue of integers. The operations that can be performed on the queue are: i. isEmpty (Q) — returns true if the queue is empty, false otherwise. ii. delete (Q) — deletes the element at the front of the queue and returns its value. iii. insert (Q, i) — inserts the integer i at the rear of the queue. Consider the following function: void f (queue Q) { int i ; if (!isEmpty(Q)) { i = delete(Q); f(Q); insert(Q, i); } }What operation is performed by the above function f ?
- Suppose a circular queue of capacity (n – 1) elements is implemented with an array of n elements. Assume that the insertion and deletion operation are carried out using REAR and FRONT as array index variables, respectively. Initially, REAR = FRONT = 0. The conditions to detect queue full and queue empty are
- If the elements A, B, C and D are placed in a stack and are deleted one at a time, what is the order of removal?