dsa quiz
5
If the numbers 5, 10, 3, 42 are enqueued onto a queue in that order, what does dequeue return?
- +pq * rt
The prefix form of an infix expression p + q - r * t is?
postfix expression
The type of expression in which operator succeeds its operands is?
oveflow
The essential condition which is checked before insertion in a linked queue is?
Stack operations are performed smoothly
Consider the following operations performed on a stack of size 5 : Push (a); Pop() ; Push(b); Push(c); Pop(); Push(d); Pop(); Pop(); Push (e) Which of the following statements is correct?
First node
Consider the linked list implementation of a stack. Which of the following node is considered as Top of the stack?
(A B D ⋀ + E F - / G +)
Convert the following infix expressions into its equivalent postfix expressions (A + B ⋀D)/(E - F)+G
C
The five items: A, B, C, D, and E are pushed in a stack, one after other starting from A. The stack is popped four items and each element is inserted in a queue. The two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack. The popped item is
350
The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is?
Find and return the position of the given element in the list.
What is the functionality of the following piece of code? public int function(int data) { Node temp = head; int var = 0; while(temp != null) { if(temp.getData() == data) { return var; } var = var+1; temp = temp.getNext(); } return Integer.MIN_VALUE; }
reuse empty spaces
What is the reason for using a "circular queue" instead of a regular one?
X
What is the result of the following operationTop (Push (S, X))
overflow
What is the term for inserting into a full queue known as?
deQueue()
Which is the correct operation for: "Remove the front item from the queue and return it"
Dequeue
A data structure in which elements can be inserted or deleted at/from both the ends but not in the middle is?
Linked list
A linear collection of data elements where the linear node is given by means of pointer is called?
c, d, W, X, Y
A queue of characters currently contained a,b,c,d. What would be the contents of queue after the following operation DELETE, ADD W, ADD X, DELETE, ADD Y.
FILO
Are stacks FIFO or FILO?
9
Consider the following array implementation of stack:#define MAX 10Struct STACK{Int arr [MAX];Int top = -1;}If the array index starts with 0, the maximum value of top which does not cause stack overflow is?
5
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
xyz*+pq*r+s*+
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.
5
In a circular queue of size 7 if front index=5 and rear index =3 then ___ dequeue operations has been performed.
(rear+1) % Number of Item
In a circular queue, how do you increment the rear end of the queue?
only one element left in the queue.
In a nonempty queue if front=rear, it means
front
In linked list implementation of a queue, from where is the item deleted?
front = null , rear = null.
In linked list implementation of a queue, the important condition for a queue to be empty is?
front is NULL
In linked list implementation of a queue, the important condition for a queue to be empty is?
rear
In linked list implementation of a queue, where does a new element be inserted?
front = 2 rear = 5 queue = ______; L, M, N, O, ___
Let the following circular queue can accommodate maximum six elements with the following data front = 2 rear = 4 queue = _______; L, M, N, ___, ___ What will happen after ADD O operation takes place?
Queues use two ends of the structure; stacks use only one.
One difference between a queue and a stack is:
True
Queue can be implemented using a list?
Rear value
The essential condition which is checked before insertion in a linked queue is?
overflow
The essential condition which is checked before insertion in a linked queue is?
AB*CD/+
The postfix form of A*B+C/D is?
LO+ VE*R - FG /**
The postfix form of the expression (L+ O)*(V*E- R)*F / G is?
stack
What data structure can be used to check if a syntax has balanced parenthesis ?
Front, Rear
What is examples of variable being used to certain algorithm to implement Queue in Array ?
Inserting a node at the end of the list
What is the functionality of the following code? public void function(Node node) { if(size == 0) head = node; else { Node temp,cur; for(cur = head; (temp = cur.getNext())!=null; cur = temp); cur.setNext(node); } size++; }
d,c,b,a
If the elements "D, "C", "B" and "A" are placed in a queue and are deleted one at a time, in what order will they be removed?
empty
If front=rear ,then the queue is?
ABCD
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