Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Trees and Graphs Quiz

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

A tree with n vertices always has:

a)

n edges

b)

n-1 edges

c)

n+1 edges

d)

2n edges

2.

Which traversal method of a binary tree gives nodes in sorted order if the tree is a Binary Search Tree (BST)?

a)

Preorder

b)

Inorder

c)

Postorder

d)

Level order

3.

The maximum number of edges in a simple undirected graph with n vertices is:

a)

n(n-1)/2

b)

n^2

c)

n(n+1)/2

d)

2n

4.

Which of the following is not a self-balancing Binary Search Tree?

a)

AVL Tree

b)

Red-Black Tree

c)

B-Tree

d)

Binary Heap

5.

In a tree, the number of leaf nodes is always equal to:

a)

Number of nodes with degree 2

b)

Number of nodes with degree 1

c)

Total nodes – internal nodes

d)

None of the above

6.

Which algorithm is commonly used to find the shortest path in a weighted graph (with positive weights)?

a)

Prim’s Algorithm

b)

Kruskal’s Algorithm

c)

Dijkstra’s Algorithm

d)

Floyd–Warshall Algorithm

7.

In a complete binary tree, the height is approximately:

a)

O(log n)

b)

O(n)

c)

O(1)

d)

O(n log n)

8.

Which data structure is best suited for implementing Breadth First Search (BFS) in a graph?

a)

Stack

b)

Queue

c)

Priority Queue

d)

Hash Table

9.

A connected graph without cycles is called:

a)

DAG (Directed Acyclic Graph)

b)

Tree

c)

Forest

d)

Complete Graph

10.

Which of the following statements about spanning trees is true?

a)

A spanning tree must contain all vertices and all edges

b)

A spanning tree must contain all vertices and no cycles

c)

A spanning tree may exclude some vertices

d)

A spanning tree must have maximum number of edges