stack and queue
stack and queue
a) -/*⋀ACBDE
b) -ABCD*⋀DE
c) -A/B*C⋀DE
d) -A/BC*⋀DE
8. What is the result of the following operation
Top (Push (S, X))
a) X
b) Null
c) S
d) None
9. The prefix form of an infix expression p + q - r * t is?
a) + pq - *rt
b) - +pqr * t
c) - +pq * rt
d) - + * pqrt
10. Which data structure is used for implementing recursion?
a) Queue
b) Stack
c) Array
d) List
11. The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?
a) 600
b) 350
c) 650
d) 588
(A + B ⋀D)/(E - F)+G
12. Convert the following infix expressions into its equivalent postfix expressions
a) (A B D ⋀ + E F - / G +)
c) (A B D ⋀ + E F/- G +)
b) (A B D +⋀ E F - / G +)
d) None
13. Convert the following Infix expression to Postfix form using a stack
x + y * z + (p * q + r) * s, Follow usual precedence rule and assume that the expression is legal.
a) xyz*+pq*r+s*+
b) xyz*+pq*r+s+*
c) xyz+*pq*r+s*+
d) none
14. Which of the following statement(s) about stack data structure is/are NOT correct?
a) Stack data structure can be implemented using linked list
b) New node can only be added at the top of the stack
c) Stack is the FIFO data structure
d) The last node at the bottom of the stack has a NULL link
15. Consider the linked list implementation of a stack. Which of the following node is
considered as Top of the stack?
a) First node
b) Last node
c) Any node
d) Middle node
16. Consider the following operation performed on a stack of size 5.
Push(1);
Pop();
Push(2);
Push(3);
Pop();
Push(4);
Pop();
Pop();
Push(5);
After the completion of all operation, the no of element present on stack are
a) 1
b) 2
c) 3
d) 4
If the array index starts with 0, the maximum value of top which does not cause stack overflow is?
a) 8
b) 9
c) 10
d) 11
22. What is the minimum number of stacks of size n required to implement a queue of size
n?
a) One
b) Two
c) Three
23. Assume that the operators +,-, X are left associative and ⋀ is right associative. The
d) Four
c) ab+c Xd – e ⋀f⋀
b) abc X+ de⋀f⋀ -
d) -+aXbc⋀ ⋀def
24. If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time,
in what order will they be removed?
a) ABCD
b) DCBA
c) DCAB
d) ABDC
25. Consider the usual implementation of parentheses balancing program using stack.
What is the maximum number of parentheses that will appear on stack at any instance of
time during the analysis of ( ( ) ( ( ) ) ( ( ) ) )?
a) 1
b) 2
c) 3
d) 4
MCQs on Queue
1. A linear list of elements in which deletion can be done from one end (front) and
insertion can take place only at the other end (rear) is known as a ?
a) Queue
b) Stack
c) Tree
d) Linked list
2. The data structure required for Breadth First Traversal on a graph is?
a) Stack
b) Array
c) Queue
d) Tree
3. A queue is a ?
a) FIFO (First In First Out) list
b) LIFO (Last In First Out) list.
c) Ordered array
d) Linear tree
5. In Breadth First Search of Graph, which of the following data structure is used?
a) Stack
b) Queue
c) Linked list
d) None
6. If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at
a time, in what order will they be removed?
a) ABCD
b) DCBA
c) DCAB
d) ABCD
10. If the MAX_SIZE is the size of the array used in the implementation of circular
queue. How is rear manipulated while inserting an element in the queue?
a) rear=(rear%1)+MAX_SIZE
b) rear=rear%(MAX_SIZE+1)
c) rear=(rear+1)%MAX_SIZE
d) rear=rear+(1%MAX_SIZE)
11. If the MAX_SIZE is the size of the array used in the implementation of circular
queue, array index start with 0, front point to the first element in the queue, and rear
point to the last element in the queue. Which of the following condition specify that
circular queue is FULL?
a) Front=rear= -1
b) Front=(rear+1)%MAX_SIZE
c) Rear=front+1
d) Rear=(front+1)%MAX_SIZE
12. A circular queue is implemented using an array of size 10. The array index starts
with 0, front is 6, and rear is 9. The insertion of next element takes place at the array
index.
a) 0
b) 7
c) 9
d) 10
13. If the MAX_SIZE is the size of the array used in the implementation of circular
queue, array index start with 0, front point to the first element in the queue, and rear
point to the last element in the queue. Which of the following condition specify that
circular queue is EMPTY?
a) Front=rear=0
b) Front= rear=-1
c) Front=rear+1
d) Front=(rear+1)%MAX_SIZE
14. A data structure in which elements can be inserted or deleted at/from both the
ends but not in the middle is?
a) Queue
b) Circular queue
c) Dequeue
d) Priority queue
15. In linked list implementation of a queue, front and rear pointers are tracked.
Which of these pointers will change during an insertion into a NONEMPTY queue?
16. A normal queue, if implemented using an array of size MAX_SIZE, gets full when
a) Rear=MAX_SIZE-1
b) Front=(rear+1)mod MAX_SIZE
c) Front=rear+1
d) Rear=front
17. In linked list implementation of a queue, front and rear pointers are tracked.
Which of these pointers will change during an insertion into EMPTY queue?
18. An array of size MAX_SIZE is used to implement a circular queue. Front, Rear,
and count are tracked. Suppose front is 0 and rear is MAX_SIZE -1. How many
elements are present in the queue?
a) Zero
b) One
c) MAX_SIZE-1
d) MAX_SIZE