No student devices needed. Know more
22 questions
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?
ABCD
DCBA
DCAB
ABDC
In linked list implementation of a queue, the important condition for a queue to be empty is?
FRONT is null
REAR is null
LINK is empty
None of the mentioned
How many stacks are needed to implement a queue. Consider the situation where no other data structure like arrays, linked list is available to you.
1
2
3
4
How many queues are needed to implement a stack. Consider the situation where no other data structure like arrays, linked list is available to you.
1
2
3
4
Which of the following is true about linked list implementation of queue?
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.
Both of the above
None of the above
Consider the following operation along with Enqueue and Dequeue operations on queues, where k is a global parameter.
What is the worst case time complexity of a sequence of n MultiDequeue() operations on an initially empty queue?
O(n)
O(n+k)
O(nk)
O(n^2)
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 queue cannot be implemented using this stack.
A queue can be implemented where ENQUEUE takes a single instruction and DEQUEUE takes a sequence of two instructions.
A queue can be implemented where ENQUEUE takes a sequence of three instructions and DEQUEUE takes a single instruction.
A queue can be implemented where both ENQUEUE and DEQUEUE take a single instruction each.
The following postfix expression with single digit operands is evaluated using a stack:
Note that ^ is the exponentiation operator. The top two elements of the stack after the first * is evaluated are:
6,1
5,7
3,2
1,5
If the sequence of operations - push (1), push (2), pop, push (1), push (2), pop, pop, pop, push (2), pop are performed on a stack, the sequence of popped out values
2,2,1,1,2
2,2,1,2,2
2,1,2,2,1
2,1,2,2,2
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
A
B
C
D
E
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?
Underflow occurs
Stack operations are performed smoothly
NoSuchElementException
EmptyStackException
Which of the following is not an inherent application of stack?
Implementation of recursion
Evaluation of a postfix expression
Job scheduling
Reverse a string
What is the value of the postfix expression 6 3 2 4 + – *
1
40
74
-18
What will be the postfix form of the above expression -
(A+B)∗(C∗D-E)∗F/G
None of these
A B + C D ∗ E − F G ∗ / ∗
A B + C D E ∗ − F G / ∗ ∗
A B + C D ∗ E − F G / ∗ ∗
In the above image what will be printed when Head->next->data?
83
9
27
Error
Which of the following statement is not correct?
List is a linear structure
There are 2 example of list, Array List & Linked List.
Array List is not an example of List
List contains a sequence of elements
What is the operation of the below statements?
Insert a new node to the front of a linked list
Create a new node for a linked list
Insert a new node to the end of the linked list
Calculate the size of a linked list
Which is the correct way to access the third node of a linked list.
Head.next(0-3)
Head[2]
Head.next.next.data
Head.get(3)
What would be the time complexity of adding an element to the front of a linked list?
O(n)
O(1)
O(n^2)
None of the above
Name the three functions of a stack data structure.
push, pop, peek
push, pop, pull
push, pop, pow
none of the above
How many fields does the node of a singly linked list has?
1
2
3
4
Explore all questions with a free account