wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PythonDS

Total questions: 20

Worksheet time: 11mins

Name
Class
Date
1.

Post order traversal :

a)

1a+b*c+d*e+f*g

b)

1abc*+de*f+g*+

c)

++a*bc*+*defg

d)

abc+*+defg*+*

2.

In Order traversal

a)

40 20 50 10 30

b)

40 50 20 30 10

c)

10 20 30 40 50

d)

50 40 20 30 10

3.

What is the MAXIMUM number of nodes in a binary search tree with height = 5 ?

a)

26-1

b)

25-1

c)

25

d)

26

e)

6

4.

What is the MINIMUM number of nodes in a binary search tree with height = 5?

a)

6

b)

5

c)

26-1

d)

25-1

e)

25

5.

What is the worst-case runtime of lookUp/get in a binary search tree?

a)

O(n)

b)

O(logn)

c)

O(1)

d)

O(n2)

6.

What is the worst-case runtime of lookUp/get in a *perfectly balanced* binary search tree?

a)

O(logn)

b)

O(n)

c)

O(1)

d)

O(n2)

7.
When deleting from a binary search tree, if the node being deleted has 2 children, we replace the entry with ____.
a)
the inorder successor
b)
null
c)
the left child
d)
the right child
e)
the parent
8.
A tree is composed of ____ connected by edges or lines.
a)
Fruit 
b)
Leaf Node
c)
Root Node
d)
Nodes
9.
A Kind of tree where every node in a tree can have at most two children.
a)
Binary Tree
b)
Binary Expression Tree
c)
Tree
d)
Binary Search Tree
10.

What is the value of the ROOT node in this Tree?

a)

35

b)

24

c)

42

d)

20

11.

Root

a)

data structure similar to a graph, with no loops.

b)

an object in a graph also known as a vertex

c)

a join of relationship between nodes - also know as an arc

d)

the starting node in a rooted tree structure from which all other nodes branch off./

12.

Binary TREE

a)

data structure similar to a graph, with no loops.

b)

an object in a graph also known as a vertex

c)

a join of relationship between nodes - also know as an arc

d)

a tree where each node can only have 2 child nodes attached to it

13.

In preorder traversal of a binary tree the second step is ____________

a)

traverse the right subtree

b)

traverse the left subtree

c)

traverse right subtree and visit the root

d)

visit the root

14.

How many leaf are there in the tree?

a)

1

b)

3

c)

4

d)

7

15.
In this tree, where would the new value "7" be placed?
a)
On the left "leaf" of "4"
b)
On the right "leaf" of "6"
c)
On the left "leaf" of "15"
d)
Over the top of the current number "5"
16.

Which of these tree traversal methods is used to output the contents of a binary tree in ascending order?

a)

Pre-Order

b)

In-Order

c)

Post-Order

d)

Monastic Orders

17.

When traversing a binary tree, which diagram is post-order?

a)
b)
c)
18.

When traversing a binary tree, which diagram is pre-order?

a)
b)
c)
19.

A Data Structure is:

a)

A C++ vector

b)

A way of organizing, storing and performing operations on data.

c)

A function in any programming language

d)

A sequence of steps to solve a problem.

20.
Root has more left descendants than the right descendants or vice versa.
a)
Balanced Tree
b)
Perfect Tree
c)
Right Tree
d)
Unbalanced Tree