Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
236 views

Data Structures (DS) (Chapter - Non Linear Data Structures - Trees) Solved MCQs (Set-2)

This document contains 50 multiple choice questions about data structures and trees. Specifically, it covers non-linear data structures like trees, different tree traversals (in-order, pre-order, post-order, level-order), properties of different types of trees (binary search trees, AVL trees, etc.), time and space complexities of tree operations, and how trees can be used to implement data structures like associative arrays.

Uploaded by

G H Vamsi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
236 views

Data Structures (DS) (Chapter - Non Linear Data Structures - Trees) Solved MCQs (Set-2)

This document contains 50 multiple choice questions about data structures and trees. Specifically, it covers non-linear data structures like trees, different tree traversals (in-order, pre-order, post-order, level-order), properties of different types of trees (binary search trees, AVL trees, etc.), time and space complexities of tree operations, and how trees can be used to implement data structures like associative arrays.

Uploaded by

G H Vamsi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Data Structures (DS) MCQs [set-2]

Chapter: Non Linear Data Structures - Trees

26. Find the postorder traversal of the binary tree shown below.
A. P Q R S T U V W X
B. W R S Q P V T U X
C. S W T Q X U V R P
D. none
Answer: C

27. For the tree below, write the in-order traversal.


A. 6, 2, 5, 7, 11, 2, 5, 9, 4
o m
B. 6, 5, 2, 11, 7, 4, 9, 5, 2
. c
C. 2, 7, 2, 6, 5, 11, 5, 9, 4
te
D. none
a
Answer: A

q M
28. For the tree below, write thec
level-order traversal.
M
A. 2, 7, 2, 6, 5, 11, 5, 9, 4
B. 2, 7, 5, 2, 11, 9, 6, 5, 4
C. 2, 5, 11, 6, 7, 4, 9, 5, 2
D. none
Answer: B

29. What is the space complexity of the in-order traversal in the recursive fashion?
(d is the tree depth and n is the number of nodes)
A. O(1)
B. O(nlogd)
C. O(logd)
D. O(d)
Answer: D

30. What is the time complexity of level order traversal?


A. O(1)
B. O(n)
C. O(logn)
D. O(nlogn)
Answer: B

31. Which of the following graph traversals closely imitates level order traversal of
a binary tree?
A. Depth First Search
B. Breadth First Search
C. Depth & Breadth First Search
D. Binary Search
Answer: B

32. In a binary search tree, which of the following traversals would print the
numbers in the ascending order?
A. Level-order traversal
B. Pre-order traversal
C. Post-order traversal
D. In-order traversal
Answer: D

33. The number of edges from the root to the node is called of the tree.
A. Height
B. Depth
C. Length
D. Width
Answer: B

34. The number of edges from the node to the deepest leaf is called of the tree.
A. Height
B. Depth
C. Length
D. Width
Answer: A

35. What is a full binary tree?


A. Each node has exactly zero or two children

Download more sets at McqMate.com


B. Each node has exactly two children
C. All the leaves are at the same level
D. Each node has exactly one or two children
Answer: A

36. What is a complete binary tree?


A. Each node has exactly zero or two children
B. A binary tree, which is completely filled, with the possible exception of the bottom level, which
is filled from right to left
C. A binary tree, which is completely filled, with the possible exception of the bottom level, which
is filled from left to right
D. A tree In which all nodes have degree 2
Answer: C

37. What is the average case time complexity for finding the height of the binary
tree?
A. h = O(loglogn)
B. h = O(nlogn)
C. h = O(n)
D. h = O(log n)
Answer: D

38. Which of the following is not an advantage of trees?


A. Hierarchical structure
B. Faster search
C. Router algorithms
D. Undo/Redo operations in a notepad
Answer: D

39. In a full binary tree if number of internal nodes is I, then number of leaves L
are?
A. L = 2*I
B. L = I + 1
C. L = I – 1
D. L = 2*I – 1
Answer: B

Download more sets at McqMate.com


40. In a full binary tree if number of internal nodes is I, then number of nodes N
are?
A. N = 2*I
B. N = I + 1
C. N = I – 1
D. N = 2*I + 1
Answer: D

41. In a full binary tree if there are L leaves, then total number of nodes N are?
A. N = 2*L
B. N = L + 1
C. N = L – 1
D. N = 2*L – 1
Answer: D

42. Which of the following is incorrect with respect to binary trees?


A. Let T be a binary tree. For every k ? 0, there are no more than 2k nodes in level k
B. Let T be a binary tree with ? levels. Then T has no more than 2? – 1 nodes
C. Let T be a binary tree with N nodes. Then the number of levels is at least ceil(log (N + 1))
D. Let T be a binary tree with N nodes. Then the number of levels is at least floor(log (N + 1))
Answer: D

43. Which of the following is false about a binary search tree?


A. The left child is always lesser than its parent
B. The right child is always greater than its parent
C. The left and right sub-trees should also be binary search trees
D. In order sequence gives decreasing order of elements
Answer: D

44. What is the speciality about the inorder traversal of a binary search tree?
A. It traverses in a non increasing order
B. It traverses in an increasing order
C. It traverses in a random fashion
D. It traverses based on priority of the node
Answer: B

45. What are the worst case and average case complexities of a binary search tree?

Download more sets at McqMate.com


A. O(n), O(n)
B. O(logn), O(logn)
C. O(logn), O(n)
D. O(n), O(logn)
Answer: D

46. What are the conditions for an optimal binary search tree and what is its
advantage?
A. The tree should not be modified and you should know how often the keys are accessed, it
improves the lookup cost
B. You should know the frequency of access of the keys, improves the lookup time
C. The tree can be modified and you should know the number of elements in the tree before
hand, it improves the deletion time
D. The tree should be just modified and improves the lookup time
Answer: A

47. Which of the following is not the self balancing binary search tree?
A. AVL Tree
B. 2-3-4 Tree
C. Red – Black Tree
D. Splay Tree
Answer: B

48. The binary tree sort implemented using a self – balancing binary search tree
takes time is worst case.
A. O(n log n)
B. O(n)
C. O(n2)
D. O(log n)
Answer: A

49. An AVL tree is a self – balancing binary search tree, in which the heights of the
two child sub trees of any node differ by
A. At least one
B. At most one
C. Two
D. At most two

Download more sets at McqMate.com


Answer: B

50. Associative arrays can be implemented using


A. B-tree
B. A doubly linked list
C. A single linked list
D. A self balancing binary search tree
Answer: D

Download more sets at McqMate.com

You might also like