wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

G&TLQ

Total questions: 76

Worksheet time: 17mins

Name
Class
Date
1.

It is specially designed node (or data items) in a tree

(a)  

2.

The (a)   of a tree is the maximum level of any node in a given tree.

3.

Which of the following statement about binary tree is CORRECT?

a)

Every binary tree is either complete or full

b)

Every complete binary tree is also a full binary tree

c)

Every full binary tree is also a complete binary tree

d)

A binary tree cannot be both complete and full

4.

Which type of traversal of binary search tree outputs the value in sorted order?

a)

Pre-order

b)

Post-order

c)

In-Order

d)

None

5.

A binary search tree is generated by inserting in order the following integers:

50, 15, 62, 5, 20, 58, 91, 3, 8, 37, 60, 24


The number of the node in the left sub-tree and right sub-tree of the root, respectively, is

a)

(4, 7)

b)

(7, 4)

c)

(8, 3)

d)

(3, 8)

6.

In delete operation of BST, we need inorder successor (or predecessor) of a node when the node to be deleted has both left and right child as non-empty. Which of the following is true about inorder successor needed in delete operation?

a)

Inorder Successor is always a leaf node

b)

Inorder successor is always either a leaf node or a node with empty left child

c)

Inorder successor may be an ancestor of the node

d)

Inorder successor is always either a leaf node or a node with empty right child

7.

What is the maximum height of any AVL-tree with 7 nodes? Assume that the height of a tree with a single node is 0.

a)

2

b)

3

c)

4

d)

5

8.

In the balanced binary tree in the figure given below, how many nodes will become unbalanced when a node is inserted as a child of the node “g”?

a)

1

b)

3

c)

7

d)

8

9.

Which of the following sequences denotes the post order traversal sequence of the tree?

a)

f e g c d b a

b)

g c b d a f e

c)

g c d b f e a

d)

f e d g c b a

10.

Example of linear data structure except

a)

array

b)

tree

c)

queue

d)

stack

11.
Which of the following is NOT a Type of Data Structures?
a)
Arrays
b)
Tables
c)
Stacks
d)
Trees
12.
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"
13.

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

14.
A tree is composed of ____ connected by edges or lines.
a)
Fruit 
b)
Leaf Node
c)
Root Node
d)
Nodes
15.
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
16.

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

17.

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

a)

35

b)

24

c)

42

d)

20

18.

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)

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

19.

How many leaf are there in the tree?

a)

1

b)

3

c)

4

d)

7

20.

What are the 3 depth traversals for a tree data structure?

a)

Pre-, In- and Post-order

b)

Pro-, In- and Past-order

c)

Pre-, Out- and Post-order

d)

Pre-, In- and New-order

21.

A connected, undirected graph with no cycles

a)

Tree

b)

Stack

c)

List

d)

Vector

22.

Data within a tree structure is stored in a h (a)   rather than linear

23.

Tree data structures begin at the bottom and work through to the top

a)

True

b)

False

24.

What is the maximum number of children each node can contain in a binary tree?

(a)  

25.

In a balanced binary tree, the depth of each subtree never differs by more than (a)  

26.

Select the correct order of steps to follow when constructing a binary tree

a)

Start at the root

If the item is less than the root - add to the left

If the item is more than the root - add to the right

b)

Start at the root

If the item is less than the root - add to the right

If the item is more than the root - add to the left

c)

Start at the bottom

If the item is less than the root - add to the left

If the item is more than the root - add to the right

End at the root

d)

Start at the bottom

If the item is less than the root - add to the right

If the item is more than the root - add to the left

End at the root

27.

Select the correct tree traversal method for the following description:

Root - Left Subtree - Right Subtree

a)

Pre-Order

b)

In-Order

c)

Post-Order

28.

Select the correct tree traversal method for the following description:

Left Subtree - Root - Right Subtree

a)

Pre-Order

b)

In-Order

c)

Post-Order

29.

Select the correct tree traversal method for the following description:

Left Subtree - Right Subtree - Root

a)

Pre-Order

b)

In-Order

c)

Post-Order

30.

Post-Order traversal is used to create a copy of the original tree

a)

True

b)

False

31.

Select the correct response for a pre-order traversal

a)

A B D E G H C F I J

b)

D B E G H A I F J C

c)

D G H E B I J F C A

32.

Select the correct response for a post-order traversal

a)

G H D I E B J F C A

b)

A B D G H E I C F J

c)

G D H B E J A J F C

33.

A binary tree data structure can be implemented as a diagram or as an (a)   of records

34.

Select all ways a leaf (node with no children) could be represented in a tree structure array table

2 answers

a)

-1

b)

Null

c)

0

35.

Enter the missing value in the array index table for this tree data structure

(a)  

36.

Enter the missing value in the array index table for this tree data structure

(a)  

37.

Which value in this array record table indicates a leaf (node with no child)?

(a)  

38.
A tree is composed of ____ connected by edges or lines.
a)
Fruit 
b)
Leaf Node
c)
Root Node
d)
Nodes
39.

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./

40.

How many leaf are there in the tree?

a)

1

b)

3

c)

4

d)

7

41.

What is the maximum height of any AVL-tree with 7 nodes? Assume that the height of a tree with a single node is 0.

a)

2

b)

3

c)

4

d)

5

42.

AVL tree got its name after its

a)

Adelson-Velsky and Landis

b)

Adam Velsky Lenin

c)

Adelson Vel Landis

d)

None

43.

The sequence of insertion 10,12,14 will lead to imbalance by using which rotation can be used to balance the tree

a)

RR rotation

b)

LL rotation

c)

LR rotation

d)

RL rotation

44.

Why we need to a binary tree which is height balanced?

a)

a) to avoid formation of skew trees

b)

b) to save memory

c)

c) to attain faster memory access

d)

d) to simplify storing

45.

Given an empty AVL tree, how would you construct AVL tree when a set of numbers are given without performing any rotations?

a)

a) just build the tree with the given input

b)

b) find the median of the set of elements given, make it as root and construct the tree

c)

c) use trial and error

d)

d) use dynamic programming to build the tree

46.

Is the following tree a valid splay tree?

a)

no

b)

yes

47.
Which of the following is TRUE about splay trees?
a)
Splay trees implement the move-to-front heuristic<br />
b)
Splay trees are perfectly balanced
c)
Inserting an entry into a splay tree has worst-case cost of O(logn)
d)
Splay trees are proper binary trees
48.

When splaying X, what is the first rotation performed?

a)

zig-zig

b)

zig-zag

c)

zig

d)

zag

49.

When splaying X, which node do you rotate FIRST?

a)

rotate T left around L

b)

rotate X left around T

c)

rotate S right around T

50.

When splaying S, what is the first rotation performed?

a)

zig-zag

b)

zig-zig

c)

zig

d)

zag

51.

When splaying S, which node do you rotate FIRST?

a)

rotate S right around T

b)

rotate T left around L

c)

rotate X left around T

52.

Post order traversal :

a)

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

b)

1abc*+de*f+g*+

c)

++a*bc*+*defg

d)

abc+*+defg*+*

53.

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

54.

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

55.

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

56.

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)

57.

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)

58.
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
59.

Which method checks that two objects are equivalent?

a)

toString

b)

equals

c)

compareTo

d)

binarySearch

60.

Binary Search works best on

a)

Equally effective on sorted and unsorted lists

b)

Unsorted lists

c)

Sorted lists

d)

None of the above

61.

If the specified value is present binary search will return

a)

true

b)

false

c)

the value

d)

the position of the value

62.

The graph shown contains NO cycles.

a)

True

b)

False

63.

The graph shown contains NO cycles.

a)

True

b)

False

64.

Create a minimal spanning tree, then find the minimum total cost.

a)

30

b)

39

c)

47

d)

50

65.
The number of vertices in a tree with 12 edges is 
a)
10
b)
11
c)
12
d)
13
66.

Using Kruskal’s algorithm, which edge should you choose second?

a)

AE

b)

BD

c)

DE

d)

AB

67.

Using Kruskal’s algorithm, which edge should you choose fourth?

a)

AB

b)

BC

c)

BD

d)

DE

68.
Which of the four graphs pictured below are trees?
a)
Graph 2
b)
Graph 2, 4
c)
Graph 2, 3
d)
Graph 2,3,4
69.
The number of edges in a tree with 32 vertices is 
a)
30
30
b)
31
c)
32
d)
33
70.

A cycle is...

a)

A path that starts and ends at different vertices.

b)

A path that starts and ends at the same vertex where backtracking is allowed.

c)

A path that starts and ends at the same vertex and uses every edge exactly once.

d)

A path that starts and ends at the same vertex and does not use any edge more than once.

71.

What is the weight of the minimum spanning tree according to Prim's Algorithm?

a)

29

b)

7

c)

11

d)

5

72.

What is the weight of the minimum spanning tree according to Prim's algorithm?

a)

7

b)

9

c)

10

d)

16

73.

How many leaf are there in the tree?

a)

1

b)

3

c)

4

d)

7

74.

A __________ is a part of a graph or the whole graph redrawn.

a)

network

b)

graph

c)

subgraph

d)

vertice

75.

What is the most accurate name for the highlighted edges in this picture?

a)

Spanning Tree

b)

Minimum Spanning Tree

c)

Tree

d)

Subgraph

76.

True or false: The black edges in this graph show one possible spanning tree.

a)

True

b)

False: It shows the MINIMUM spanning tree

c)

False: It does not show a spanning tree because there are cycles present

d)

False: It does not show a spanning tree because it does not reach to every vertex