NEW
Font size
WorksheetsMidtermExam-FCPC-DiscreteStructure
Total questions: 47
Worksheet time: 47mins
A graph is made up of:
Only edges
Only vertices
Vertices and edges
Numbers only
A graph with no edges is called:
Simple graph
Null graph
Complete graph
Tree
In an undirected graph, edges:
Have a direction
Do not have direction
Point to one vertex
Always form a loop
The degree of a vertex is:
Number of loops
Number of edges connected to it
Number of vertices in graph
Number of components
A simple graph cannot have:
Loops
Parallel edges
Both A and B
Weighted edges
The number of edges in a complete graph with 4 vertices is:
4
5
6
8
A tree is a connected graph with:
No loops
No cycles
No weights
Both A and B
A connected graph with n vertices must have at least:
n edges
n−1 edges
n+1 edges
n² edges
A cycle in a graph means:
All edges are removed
Vertices form a closed path
Graph is disconnected
Only one vertex exists
In a directed graph, edges have:
Weight
No endpoints
Direction
None
A graph with all vertices connected to every other vertex is called:
Simple graph
Tree
Complete graph
Path
The adjacency matrix stores:
Vertex names
Edge connections between vertices
Edge colors
None
The sum of all vertex degrees in an undirected graph is equal to:
Number of edges
Twice the number of edges
Half the number of edges
None
A disconnected graph means:
All vertices are connected
Some vertices are not connected
No vertices
Graph is empty
A loop in a graph is:
An edge from a vertex to itself
An edge to another vertex
A long path
A cycle with 2 edges
A graph with a single vertex and no edges is called:
Null graph
Simple graph
Complete graph
Empty graph
The adjacency list is used to store:
List of vertices only
List of connected vertices for each vertex
Edge weights
Graph colors
The number of edges in a tree with 10 vertices is:
9
10
8
11
A planar graph can be drawn on paper:
Without edges crossing
Only in 3D
With loops
With multiple edges
Two vertices are adjacent if:
They are same
They are connected by an edge
They have same degree
They are disconnected
A graph with edges showing distance is called:
Directed graph
Weighted graph
Simple graph
Complete graph
The number of vertices in a triangle graph (cycle) is:
2
3
4
5
A path is a sequence of:
Random numbers
Connected vertices
Loops
Unconnected edges
In a simple connected graph, removing one edge can make it:
Disconnected
Complete
Loopless
Weighted
A minimum spanning tree contains:
All edges
All vertices
Both A and B
Random edges
Dijkstra’s algorithm is used to find:
Shortest path
Minimum spanning tree
Largest path
Maximum flow
Dijkstra’s algorithm works only with:
Negative weights
Positive weights
Directed acyclic graphs
Trees
The starting point of Dijkstra’s algorithm is called:
Source vertex
Root
Parent node
Leaf
Dijkstra’s algorithm is based on:
Breadth-first search
Greedy method
Divide and conquer
Dynamic programming
In Dijkstra’s algorithm, once a vertex is marked “visited”:
Its shortest path is found
It can still change
It’s removed
The main data structure used in Dijkstra’s algorithm is:
Stack
Queue
Priority queue
Linked list
Dijkstra’s algorithm fails when:
Graph is disconnected
Graph has negative edge weights
Graph has loops
Graph has too many vertices
The first step in Dijkstra’s algorithm is to:
A. Initialize all distances to infinity
B. Select smallest vertex
C. Remove all edges
D. Create adjacency list
In Dijkstra’s algorithm, distance to the source vertex is always:
0
1
Infinity
Undefined
Dijkstra’s algorithm stops when:
All vertices are visited
The destination is found
Both A and B
Dijkstra’s algorithm gives correct results only if:
Edges are positive
Graph is undirected
Graph has cycles
Graph is complete
If a vertex has distance ∞ (infinity) after algorithm ends, it means:
It’s unreachable
It has smallest distance
It’s a loop
It’s weighted
Dijkstra’s algorithm can be applied to:
Road networks
Binary trees
Stacks
Queues
The output of Dijkstra’s algorithm is:
Minimum spanning tree
Shortest distance from source to all vertices
Graph degree
Number of edges
Prim’s algorithm is used to find:
Shortest path
Minimum spanning tree
Maximum flow
Longest path
Which of the following is a greedy algorithm?
Prim’s algorithm
Divide and conquer
Backtracking
Dynamic programming
Prim’s algorithm starts from:
Any vertex
Smallest edge
Source vertex only
Center vertex
The main data structure used in Prim’s algorithm is:
Stack
Queue
Priority queue
Array
Prim’s algorithm works for:
Directed graphs
Undirected graphs
Weighted directed graphs
All graphs
In Prim’s algorithm, edges are added if they:
Form a cycle
Connect a new vertex
Have negative weight
Are already visited
Prim’s algorithm stops when:
All vertices are included in the tree
One vertex remains
All edges are used
No edge left
The output of Prim’s algorithm is:
Shortest path
Minimum spanning tree
Weighted path
Hamiltonian cycle
