0% found this document useful (0 votes)
112 views3 pages

Programming and Data Structures TREES (Set-1) 1. Consider The Following Tree

The document discusses trees and binary trees. It provides 16 multiple choice questions about tree traversal orders, properties of binary search trees and binary trees, and operations like inserting a new node. The questions cover topics like post-order traversal, placing a new node in a binary search tree during sorting, the number of nodes in strictly binary and complete binary trees, and preorder being the same as depth-first order traversal.

Uploaded by

dannyboy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views3 pages

Programming and Data Structures TREES (Set-1) 1. Consider The Following Tree

The document discusses trees and binary trees. It provides 16 multiple choice questions about tree traversal orders, properties of binary search trees and binary trees, and operations like inserting a new node. The questions cover topics like post-order traversal, placing a new node in a binary search tree during sorting, the number of nodes in strictly binary and complete binary trees, and preorder being the same as depth-first order traversal.

Uploaded by

dannyboy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

PROGRAMMING AND DATA STRUCTURES

TREES (Set-1)

1. Consider the following tree:

If the post-order traversal gives ab-cd*+ then the label of the nodes 1, 2, 3,….. will be:

(a) +, -, *, a, b, c, d (b) a, -, b, +, c, *, d
(c) a, b, c, d, -, *, + (d) -, a, b, +, *, c, d

2. Consider the following tree:

If this tree is used for sorting, then a new number 8 should be placed as:

(a) left child of the node labeled 30


(b) right child of the node labeled 5
(c) right child of the node labeled 30
(d) left child of the node labeled 10

3. A binary tree in which every non-leaf node has non-empty left and right subtrees is called a
strictly binary tree. Such a tree with 10 leaves.

(a) cannot have more than 19 nodes (b) has exactly 19 nodes
(c) has exactly 17 nodes (d) cannot have more than 17 nodes

1
4.The depth of a complete binary tree with ‘n’ nodes is (log is to the base 2):

(a) log (n+1) -1 (b) log (n)


(c) log (n-1) +1 (d) log (n) +1

5.Preorder is same as:

(a) depth-first order (b) breadth-first search


(c) topological order (d) linear order

6.Which of the following traversal techniques lists the nodes of a binary search tree in ascending
order?

(a) Post-order (b) In-order


(c) Pre-order (d) None of these

7.The no. of possible binary trees with 3 nodes are:

(a) 12 (b) 13
(c) 5 (d) 15

8.The number of possible binary trees with 4 nodes are:

(a) 12 (b) 13
(c) 14 (d) 15

9.The postfix equivalent of the tree whose prefix order is → * + ab – cd is:

(a) ab + cd - * (b) ab cd + - *
(c) ab + cd * - (d) ab + - cd *

10.A binary tree has n leaf nodes. the no. of nodes of degree 2 in this tree is:

(a) log2n (b) n-1


(c) n (d) 2n

2
11.The no. of binary trees with 3 nodes which when traversed by post-order gives the sequence
A, B, C is:

(a) 3 (b) 9
(c) 7 (d) 5

12.A 3-ary tree is a tree in which every internal node has exactly 3 children. The no. of leaf
nodes in such a tree with 6 internal nodes will be:

(a) 10 (b) 23
(c) 17 (d) 13

13.Which of the following need not be binary tree?

(a) Search tree (b) Heap


(c) AVL- Tree (d) B-Tree

14.The height of a binary tree is the maximum number of edges of any root to leaf path. The
maximum number of nodes in a binary tree of height n is:

(a) 2n-1 (b) 2n-1-1


(c) 2n+1-1 (d) 2n+1

15.The inorder and preorder traversal of a binary tree are:


d b e a f e g and a b d e c f g respectively. The post order traversal of the binary tree is:

(a) d e b f g c a (b) e d b g f c a
(c) e d b f g c a (d) d e f g b c a

16.The binary search tree contains the values—1, 2, 3, 4, 5, 6, 7 and 8. The tree is traversed in
preorder and the values are printed out. Which of the following sequences is a valid output?

(a) 5 3 1 2 4 7 8 6 (b) 5 3 1 2 6 4 8 7
(c) 5 3 2 4 1 6 7 8 (d) 5 3 1 2 4 7 6 8

You might also like