Top 50 Data Structures MCQs with Answers (original) (raw)
The minimum number of stacks needed to implement a queue is
Which of the following is true about linked list implementation of stack?
- 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.
Which one of the following is an application of Stack Data Structure?
- Arithmetic expression evaluation
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
Stack A has the entries a, b, c (with a on top). Stack B is empty. An entry popped out of stack A can be printed immediately or pushed to stack B. An entry popped out of the stack B can be only be printed. In this arrangement, which of the following permutations of a, b, c are not possible?
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
Which of the following is TRUE?
- The cost of searching an AVL tree is θ (log n) but that of a binary search tree is O(n)
- The cost of searching an AVL tree is θ (log n) but that of a complete binary tree is θ (n log n)
- The cost of searching a binary search tree is O (log n ) but that of an AVL tree is θ(n)
- The cost of searching an AVL tree is θ (n log n) but that of a binary search tree is O(n)
Let G be the directed, weighted graph shown in below figure
We are interested in the shortest paths from A. (a) Output the sequence of vertices identified by the Dijkstra’s algorithm for single source shortest path when the algorithm is started at node A. (b) Write down sequence of vertices in the shortest path from A to E. (c) What is the cost of the shortest path from A to E?
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is
Consider the following statements:
i. First-in-first out types of computations are efficiently supported by STACKS.
ii. Implementing LISTS on linked lists is more efficient than implementing LISTS on an array for almost all the basic LIST operations.
iii. Implementing QUEUES on a circular array is more efficient than implementing QUEUES on a linear array with two indices.
iv. Last-in-first-out type of computations are efficiently supported by QUEUES.
Which of the following is correct?
There are 50 questions to complete.
Take a part in the ongoing discussion