advertisement

COMP 202: Data Structure and Algorithms Quiz #4 [ SOLUTION ] : 15th December 2014 (Trees and Graph) YOUR NAME: Duration : 20 minutes. Full marks = 15 Circle the best answer. Figure 1: Binary Search Tree Figure 2: A Graph 1. Conside a Figure 1. If you want to insert a node 31, where should be its location? A. left of node 35 " B. left of node 47 C. right of node 28 D. right of node 35 2. Consider a Figure 1. What is the next possible node to be considered as a root node if you delete a node 26? A. node 23 only B. neither node 23 nor node 28 C. either node 23 or node 28 " D. node 28 only 3. Consider a graph of Figure 2. Which of the following statements is TRUE? A. Minimum spanning tree includes edge <C,D>. B. Prim’s algorithm is not application in the given graph to calculate minimum spanning tree. C. The given graph is a directed graph of total weight 28. D. none of the above " 4. Select the one FALSE statement about binary trees: A. every non-root node has exactly one parent B. every binary tree has at least one node " C. every non-empty tree has exactly one root node D. every node has at most two children 5. Select the one TRUE statement. A. no binary tree is both complete and strictly binary tree. B. every complete binary tree is also a strictly binary tree " C. every binary tree is either complete or strictly binary tree D. every strictly binary tree is also a complete binary tree 6. Consider a right sub-tree of a Figure 1. What is the output of In-Order traversal? A. 41 30 28 38 35 39 47 B. 41 28 39 35 38 39 47 C. 28 30 38 35 39 41 47 D. 28 30 35 38 39 41 47 " 7. A Binary tree in which every non-leaf node has non-empty left and right sub trees is called a strictly binary tree. Such a tree with 10 leaves A. has 19 nodes " Page 2 B. has 16 nodes C. has 15 nodes D. none of the above 8. Consider a graph of Figure 2. What is the weight of Minimum Spanning Tree of a given Graph. A. 13 " B. 12 C. 14 D. 16 9. Suppose T is a binary tree with 14 nodes. What is the minimum possible depth of T? A. 3 " B. 0 C. 4 D. 5 10. What graph traversal algorithm uses a queue to keep track of vertices which need to be processed? " A. Breadth First Search B. neither BFS nor DFS C. Depth First Search D. both DBS and BFS 11. What is the minimum number of nodes in a strictly binary tree with depth 3? A. 7 " B. 9 C. 10 D. 8 12. Consider a Figure 1. How many comparisions are required to search a node 14? A. 5 " B. 7 C. 4 D. 6 13. Consider a Figure 1. What is the depth of given Binary Tree? A. 3 B. 4 C. 6 D. 5 " 14. Consider a Figure 1. What is the maximum number of comparisions to be performed to search a node that does not exist at all? A. 8 B. 6 C. 7 " D. 5 15. If G is a directed graph with 20 vertices, how many boolean values will be needed to represent G using an adjacency matrix? A. 400 " B. 40 C. 200 D. 20 16. In your opinion, what is the degree of difficulty level of this quiz? 1 being the easiest and 10 being the most difficult one. 1 2 3 4 5 6 7 *** THE END *** Page 3 8 9 10