MCQ (Stack & Queue)
MCQ (Stack & Queue)
1. Email *
2. What is the major disadvantage of using a queue which is implemented with * 1 point
3. What is the condition for a queue to be considered full when implemented * 1 point
https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 1/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)
4. Assume that a queue implemented using two stacks. How many times will * 1 point
5. If in a circular queue, the front pointer is at index 0 and the rear pointer is at * 1 point
index N-1, and an element is dequeued, where should the rear pointer point
to?
Index 0
Index N-2
Index N
6. Assume that a queue is being used to model the process of printing jobs in * 1 point
a printer. If a job with higher priority arrives at the queue, what type of queue
will be best suited for this scenario?
Simple Queue
Circular Queue
Priority Queue
Double-ended Queue
https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 2/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)
[A, B, C]
[B, C]
[A, C]
[C]
8. Assume that a queue can hold up to N elements, and the queue is * 1 point
implemented using a circular array. What will happen if we insert one more
element when the queue is full?
FRONT=NULL
REAR=NULL
FRONT=MAX_QUEUE
REAR=MAX_QUEUE
https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 3/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)
10 30 10 15
20 30 40 15
20 30 40 10
10 30 40 15
11. To implement a stack using queue(with only enqueue and dequeue 1 point
operations), how many queues will you need?
12. Which of the following is true about linked list implementation of stack? 1 point
In push operation, if new nodes are inserted at the beginning of linked list, then in
pop operation, nodes must be removed from end.
In push operation, if new nodes are inserted at the end, then in pop operation,
nodes must be removed from the beginning.
https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 4/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)
LIFO
FIFO
FILO
LILO
POP
PUSH
PEEK
Stack
Queue
Linked List
Array
Infix Expression
Prefix Expression
Postfix Expression
Algebraic Expression
https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 5/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)
17. Consider the following pseudocode that uses a stack. What is output for input 1 point
"Stack"?
kcatS
StackStack
Stack
None of above
18. A single array A[1..MAXSIZE] is used to implement two stacks. The two 1 point
stacks grow from opposite ends of the array. Variables top1 and top2 (top1<
top 2) point to the location of the topmost element in each of the stacks. If
the space is to be used efficiently, the condition for “stack full” is
top1= top2 -1
https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 6/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)
abc × + def ^ ^ -
abc × + de ^ f ^ -
ab + c × d - e ^ f ^
- + a × bc ^ ^ def
+ pq - *rt
- +pqr * t
- + * pqrt
- +pq * rt
https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 7/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)
22. The type of expression in which operator succeeds its operands is? 1 point
Infix Expression
Prefix Expression
Postfix Expression
-/*^ACBDE
-ABCD*^DE
-A/B*C^DE
-A/BC*^DE
40
74
-18
25. User push 1 element in the stack having already five elements and having 1 point
Crash
User Flow
Overflow
Underflow
https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 8/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)
at both ends
Both A & B.
None
27. From the following which are static and dynamic representations of stacks? 1 point
28. What is the number of moves required to solve Tower of Hanoi problem for k 1 point
disks?
2k – 1
2k + 1
2^k-1
2^k+1
29. Postfix operation does not follow the rules of operator precedence. 1 point
True
False
https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 9/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)
True
False
31. Using a recursive function takes more memory and time to execute. 1 point
True
False
32. The recursive function fun(int n){if (n==1) return 1;else return n*fun(n-1);} will 1 point
33. Consider a stack having 3 nodes with value A,B,C and C is at the TOP while 1 point
A is the first inserted node. What will be the instance of STACK after
POP(),PUSH(A),PUSH(B),POP(),PUSH(C)
ABAC->TOP
ABCABC->TOP
BCCB->TOP
ACAB->TOP
https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 10/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)
push(pop()), push(Z),push(pop())
push(Z)
push(pop()),push(pop()),push(Z)
35. The most appropriate data structure to find if the given word is a palindrome 1 point
or not
queue
tree
stack
graph
36. What are the set of functions that are to be executed on a stack to get RJIT 1 point
as output
Forms
https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 11/11