Dark Mode On/Off

# Data Structure and Algo Questions

This Test will cover basic concepts of data Structure and related algorithm.
Q. What is the total number of swaps required to create max heap using the following array?
 31 14 19 29 11 24 15
 A. 3 B. 4 C. 2 D. 1
Q. What is the minimum number of bits required to represent alphabet 'f' using huffman's encoding?
 Alphabet A b C d e F g Frequency 50 40 30 20 10 5 0
 A. 3 B. 4 C. 5 D. 6
Q. We use dynamic programming approach when:
 A. The solution has optimal substructure & overlapping sub problems B. When all the sub problems are unique C. Both (A) & (B) D. None of these

Q. What is the length of longest common sub-sequence in the following string set?
``````
X = 'PQRQSPQ'
Y = 'QSRPQP'
``````
 A. 3 B. 4 C. 5 D. 6
Q. Which of the following problems require dynamic programming paradigm?
 A. Fractional Knap sack B. 0/1 knap sack C. Huffman encoding D. Dijkastra's algorithm
Q. Which of the following statements are necessarily true?
(I) Dijkastra's algorithm for single source shortest path can be used for negative weight cycle.
(II) Dijkastra's algorithm for non negative weight cycle is better than bellman ford algorithm.
(III) Dijkastra's algorithm is also applicable for all pair shortest path also .
(IV) Bellman ford algorithm can be used for all pair shortest path.
 A. I B. II C. III D. IV
Q. Which of the following is NOT the typical application of Stack?
 A. Recursive function call handling B. Balanced parenthesis problem C. Evaluation of post fix expression D. CPU bound and Input Output bound process selection
Q. What is the worst case time complexity for searching, insertion and deletion operations in a Binary Search Tree?
 A. O(log n) for all operations B. O(n) for all operations C. O(n) , O(log n) , O(n log n) respectively D. None of these

Q. Which of the following pair of traversals are self sufficient to draw unique binary tree?
 A. Level order & preorder B. Pre-order & post-order C. In order & post order D. Level-order & post order
Q. Which of the following traversal will provide sorted list of elements present in binary search tree?
 A. Level Order B. Pre-order C. Post Order D. In Order
Q. What is the value of the below post fix notation ?

`512+4x+2`

 A. 14 B. 15 C. 16 D. 17
Q. What is the time complexity of Breadth first traversal using Breadth first search algorithm for a graph having more than one connected components?
 A. O[EV] B. O [E+V] C. O[E log V] D. O[V]

Q. Consider three matrices A,B and C which are compatible for matrix multiplication in the order 'ABC'.
Then in how many ways we can perform matrix multiplication?
 A. 3 ways B. 2 ways C. 1 way D. 4 ways
Q. Consider three matrices A [2 X 1] , B[1 X 2] and C[2 X 4].
What is the minimum number of multiplications required for matrix multiplication of the matrices in the order 'ABC'?
 A. 20 B. 24 C. 16 D. 15
Q. Which of the following algorithm is self sufficient to implement dijkastra's algorithm for single source shortest path for non-weighted graph?
 A. Depth first traversal B. Breadth first traversal C. Warshall algorithm D. Ford Fulkerson algorithm

### Related Tests:

#### Explore more Subjects:

Tests for various other programming languages and subjects: