Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.
Question 1 of 60 · labelled and weighted graph · Easy
In a weighted graph, what does the weight assigned to an edge typically represent?
Not quite. Try another option.
Answer: A numerical value such as cost, distance, or time
In a weighted graph, each edge is assigned a numerical value (weight) that may represent quantities like distance, cost, or time.
Question 2 of 60 · labelled and weighted graph · Easy
A graph in which each vertex or edge is assigned a name or label is called a:
Not quite. Try another option.
Answer: Labelled graph
A labelled graph is one where vertices and/or edges are given distinct labels or names to identify them.
Question 3 of 60 · shortest path in weighted graphs · Easy
The shortest path between two vertices in a weighted graph is the path with the:
Not quite. Try another option.
Answer: Minimum total edge weight
The shortest path is defined as the path between two vertices for which the sum of the edge weights is minimum.
Question 4 of 60 · shortest path in weighted graphs · Easy
In an unweighted graph, the shortest path between two vertices is measured by the:
Not quite. Try another option.
Answer: Number of edges in the path
When a graph has no weights, every edge is treated as weight 1, so the shortest path is simply the one with the fewest edges.
Question 5 of 60 · Dijkstra's algorithm to find shortest path · Easy
Dijkstra's algorithm is used to find the shortest path from:
Not quite. Try another option.
Answer: A single source vertex to all other vertices
Dijkstra's algorithm computes the shortest paths from one chosen source vertex to all remaining vertices in the graph.
Question 6 of 60 · Dijkstra's algorithm to find shortest path · Easy
A key limitation of Dijkstra's algorithm is that it does not work correctly with:
Not quite. Try another option.
Answer: Negative edge weights
Dijkstra's algorithm assumes all edge weights are non-negative; negative weights can produce incorrect results.
Question 7 of 60 · Dijkstra's algorithm to find shortest path · Easy
At each step, Dijkstra's algorithm selects the unvisited vertex with the:
Not quite. Try another option.
Answer: Smallest known distance from the source
The algorithm greedily picks the unvisited vertex having the minimum tentative distance and finalizes it.
Question 8 of 60 · introduction to tree · Easy
A tree is best defined as a connected graph that:
Not quite. Try another option.
Answer: Contains no cycles
A tree is a connected, acyclic graph — it has no cycles.
Question 9 of 60 · introduction to tree · Easy
A tree with vertices always has exactly how many edges?
Not quite. Try another option.
Answer:
Any tree with vertices contains exactly edges.
Question 10 of 60 · introduction to tree · Easy
How many paths exist between any two distinct vertices in a tree?
Not quite. Try another option.
Answer: Exactly one
In a tree there is a unique simple path connecting any two vertices, which follows from it being connected and acyclic.
Question 11 of 60 · rooted tree · Easy
In a rooted tree, the topmost vertex from which the tree originates is called the:
Not quite. Try another option.
Answer: Root
A rooted tree has one specially designated vertex called the root from which all other vertices descend.
Question 12 of 60 · rooted tree · Easy
In a rooted tree, a vertex that has no children is known as a:
Not quite. Try another option.
Answer: Leaf node
A leaf (or terminal) node is a vertex in a rooted tree that has no children.
Question 13 of 60 · binary tree · Easy
A binary tree is a rooted tree in which every node has at most:
Not quite. Try another option.
Answer: Two children
In a binary tree each node can have a maximum of two children, usually called the left and right child.
Question 14 of 60 · binary tree · Easy
What is the maximum number of nodes at level of a binary tree, taking the root as level ?
Not quite. Try another option.
Answer:
At level , a binary tree can have at most nodes since the number of nodes doubles at each level.
Question 15 of 60 · spanning tree · Easy
A spanning tree of a connected graph is a subgraph that:
Not quite. Try another option.
Answer: Includes all vertices of and is a tree
A spanning tree contains every vertex of the original graph while remaining a tree (connected and acyclic).
Question 16 of 60 · spanning tree · Easy
A spanning tree of a connected graph with vertices contains exactly how many edges?
Not quite. Try another option.
Answer:
Since a spanning tree is a tree containing all vertices, it has exactly edges.
Question 17 of 60 · minimum spanning tree · Easy
A minimum spanning tree (MST) of a weighted graph is the spanning tree with the:
Not quite. Try another option.
Answer: Minimum total edge weight
An MST is a spanning tree whose sum of edge weights is the smallest among all possible spanning trees.
Question 18 of 60 · Kruskal and Prims algorithms to find minimum spanning tree · Easy
Kruskal's algorithm builds a minimum spanning tree by considering edges in order of:
Not quite. Try another option.
Answer: Increasing weight
Kruskal's algorithm sorts all edges by weight in ascending order and adds them one by one, skipping any that form a cycle.
Question 19 of 60 · Kruskal and Prims algorithms to find minimum spanning tree · Easy
While adding edges, Kruskal's algorithm avoids selecting an edge that would:
Not quite. Try another option.
Answer: Form a cycle
Kruskal's algorithm rejects any edge whose inclusion would create a cycle, ensuring the result remains a tree.
Question 20 of 60 · Kruskal and Prims algorithms to find minimum spanning tree · Easy
Prim's algorithm builds the minimum spanning tree by:
Not quite. Try another option.
Answer: Growing the tree one vertex at a time from a starting vertex
Prim's algorithm starts from a chosen vertex and repeatedly adds the smallest-weight edge that connects a new vertex to the growing tree.
Question 21 of 60 · labelled and weighted graph · Medium
In a weighted graph, the sum of the weights of all edges in a path is called the:
Not quite. Try another option.
Answer: Path length or path weight
In a weighted graph, the weight (or length) of a path is the sum of the weights of the edges that make up the path.
Question 22 of 60 · labelled and weighted graph · Medium
A weighted graph has edges with weights that represent distances. If an edge between vertices and has weight and no edge exists between and , which statement is correct?
Not quite. Try another option.
Answer: The distance is considered until a path is found
When no direct edge exists, the cost is taken as in shortest-path computations until an actual path is discovered.
Question 23 of 60 · shortest path in weighted graphs · Medium
Which property must hold for a shortest path between two vertices in a weighted graph with non-negative weights?
Not quite. Try another option.
Answer: Every subpath of a shortest path is also a shortest path
This is the optimal substructure property: any subpath of a shortest path is itself a shortest path between its endpoints.
Question 24 of 60 · shortest path in weighted graphs · Medium
A shortest path that minimizes the number of edges rather than total weight would be found by treating the graph as:
Not quite. Try another option.
Answer: An unweighted graph and using BFS
When all edges count equally, minimizing edge count is equivalent to a BFS traversal on an unweighted graph.
Question 25 of 60 · Dijkstra's algorithm to find shortest path · Medium
Dijkstra's algorithm fails to give correct results when the graph contains:
Question 26 of 60 · Dijkstra's algorithm to find shortest path · Medium
In Dijkstra's algorithm, once a vertex is marked as finalized (added to the set of visited vertices), its shortest distance:
Not quite. Try another option.
Answer: Will never change again
Dijkstra finalizes a vertex only when its minimum distance is confirmed; with non-negative weights this value is never updated afterward.
Question 27 of 60 · Dijkstra's algorithm to find shortest path · Medium
Consider a graph with edges , , . Using Dijkstra from , the shortest distance to is:
Not quite. Try another option.
Answer:
The path costs , which is less than the direct edge .
Question 28 of 60 · Dijkstra's algorithm to find shortest path · Medium
Using a binary min-heap (priority queue), the time complexity of Dijkstra's algorithm for a graph with vertices and edges is:
Not quite. Try another option.
Answer:
With a binary heap, each extract-min and decrease-key operation costs , giving an overall .
Question 29 of 60 · introduction to tree · Medium
A connected graph with vertices is a tree if and only if it has exactly:
Not quite. Try another option.
Answer: edges
A tree on vertices is connected and acyclic, which forces exactly edges.
Question 30 of 60 · introduction to tree · Medium
Which of the following is NOT necessarily true for a tree?
Not quite. Try another option.
Answer: It contains at least one cycle
A tree is acyclic by definition; the other three statements are all valid properties of trees.
Question 31 of 60 · rooted tree · Medium
In a rooted tree, a vertex with no children is called a:
Not quite. Try another option.
Answer: Leaf (or terminal node)
A leaf is a node that has no children; internal nodes have at least one child.
Question 32 of 60 · rooted tree · Medium
In a rooted tree, the length of the path from the root to a given node is called that node's:
Not quite. Try another option.
Answer: Depth (or level)
Depth is the number of edges from the root to the node; height is measured from a node down to the deepest leaf.
Question 33 of 60 · binary tree · Medium
The maximum number of nodes in a binary tree of height (root at height ) is:
Not quite. Try another option.
Answer:
A full binary tree of height has nodes.
Question 34 of 60 · binary tree · Medium
A binary tree with internal nodes, where every internal node has exactly two children (a full binary tree), has how many leaf nodes?
Not quite. Try another option.
Answer:
In a full binary tree, the number of leaves is always one more than the number of internal nodes: .
Question 35 of 60 · binary tree · Medium
How many distinct binary trees can be formed using unlabelled nodes?
Not quite. Try another option.
Answer:
The number of distinct binary trees with nodes is the Catalan number ; for , .
Question 36 of 60 · spanning tree · Medium
A spanning tree of a connected graph with vertices always contains:
Not quite. Try another option.
Answer: Exactly edges
A spanning tree includes all vertices while remaining a tree, so it has exactly edges and no cycles.
Question 37 of 60 · spanning tree · Medium
By Cayley's formula, the number of distinct spanning trees of a complete graph is:
Not quite. Try another option.
Answer:
Cayley's formula gives spanning trees for ; for , this is .
Question 38 of 60 · minimum spanning tree · Medium
If all edge weights in a connected graph are distinct, then the minimum spanning tree is:
Not quite. Try another option.
Answer: Unique
When all edge weights are distinct, there is exactly one minimum spanning tree for the graph.
Question 39 of 60 · Kruskal and Prims algorithms to find minimum spanning tree · Medium
Kruskal's algorithm selects edges in increasing order of weight while avoiding cycles. Which data structure efficiently detects cycles during this process?
Not quite. Try another option.
Answer: Union-Find (disjoint set)
The Union-Find structure quickly checks whether two vertices are already connected, preventing cycle formation.
Question 40 of 60 · Kruskal and Prims algorithms to find minimum spanning tree · Medium
A key difference between Prim's and Kruskal's algorithms is that Prim's algorithm:
Not quite. Try another option.
Answer: Grows a single connected tree from a starting vertex
Prim's maintains one growing connected tree, whereas Kruskal's may temporarily maintain a forest of components.
Question 41 of 60 · Dijkstra's algorithm to find shortest path · Hard
Dijkstra's algorithm may produce incorrect shortest-path results when a graph contains which of the following?
Not quite. Try another option.
Answer: Negative weight edges
Dijkstra's greedy strategy finalizes a vertex's distance once it is extracted from the priority queue. A negative edge encountered later can offer a shorter path, but the vertex is already finalized, giving wrong results. Parallel edges, many vertices, and positive self-loops do not break correctness.
Question 42 of 60 · Dijkstra's algorithm to find shortest path · Hard
Using a binary min-heap as the priority queue, the time complexity of Dijkstra's algorithm on a graph with vertices and edges is:
Not quite. Try another option.
Answer:
Each vertex extraction is giving , and each edge relaxation performs a decrease-key of giving . Together this is . The bound applies to the array-based implementation.
Question 43 of 60 · minimum spanning tree · Hard
If all edge weights in a connected weighted graph are distinct, which statement about its minimum spanning tree (MST) is true?
Not quite. Try another option.
Answer: The MST is unique
When all edge weights are distinct, the cut property and cycle property each select edges unambiguously, so exactly one MST exists. Multiple MSTs can only occur when some edge weights are equal.
Question 44 of 60 · spanning tree · Hard
By Cayley's formula, the number of distinct spanning trees of the complete graph is:
Not quite. Try another option.
Answer:
Cayley's formula gives spanning trees for . For , this is .
Question 45 of 60 · Kruskal and Prims algorithms to find minimum spanning tree · Hard
The Union-Find data structure with union by rank and path compression is used in Kruskal's algorithm primarily to:
Not quite. Try another option.
Answer: Efficiently detect whether adding an edge forms a cycle
Kruskal's adds an edge only if its endpoints lie in different components. Union-Find checks connectivity (cycle detection) in near-constant amortized time. Sorting is done separately, typically in .
Question 46 of 60 · binary tree · Hard
A binary tree has internal nodes each with exactly two children (a full binary tree). How many leaf nodes does it have?
Not quite. Try another option.
Answer:
In a full binary tree, the number of leaves equals the number of internal (degree-2) nodes plus one, i.e. . This follows from counting edges: edges connect to leaves plus the remaining internal nodes.
Question 47 of 60 · Prims algorithm to find minimum spanning tree · Hard
Prim's algorithm grows the MST by repeatedly selecting the minimum-weight edge that:
Not quite. Try another option.
Answer: Crosses the cut between the tree and the remaining vertices
Prim's maintains a growing tree and, at each step, adds the cheapest edge crossing the cut separating tree vertices from non-tree vertices. This is a direct application of the cut property.
Question 48 of 60 · labelled and weighted graph · Hard
A weighted graph has vertices. Which representation gives time to query the weight of a specific edge ?
Not quite. Try another option.
Answer: Adjacency matrix
An adjacency matrix stores the weight of edge at position , allowing direct lookup. Adjacency lists and edge lists require scanning, and an incidence matrix requires scanning columns.
Question 49 of 60 · minimum spanning tree · Hard
Consider a connected weighted graph. If an edge is the unique maximum-weight edge on some cycle, which property guarantees is excluded from the MST?
Not quite. Try another option.
Answer: The cycle property
The cycle property states that the unique heaviest edge in any cycle cannot belong to any MST, since removing it and using the cycle's other edges yields a lighter spanning structure.
Question 50 of 60 · shortest path in weighted graphs · Hard
In a weighted graph where every edge weight is multiplied by a positive constant , the shortest path between any two vertices:
Not quite. Try another option.
Answer: Remains the same set of edges, with total cost scaled by
Scaling all weights by a positive constant preserves the relative ordering of every path's cost, so the optimal route is unchanged while its total cost is multiplied by .
Question 51 of 60 · rooted tree · Hard
In a rooted tree with nodes, what is the sum of the number of children over all nodes?
Not quite. Try another option.
Answer:
Every node except the root is the child of exactly one parent, so counting children over all nodes equals the number of non-root nodes, which is (also the number of edges).
Question 52 of 60 · Dijkstra's algorithm to find shortest path · Hard
During Dijkstra's execution, at the moment a vertex is extracted from the priority queue, which invariant holds?
Not quite. Try another option.
Answer: The distance label of equals its true shortest distance from the source
Dijkstra's correctness rests on the fact that when the minimum-label vertex is extracted, its label already equals the true shortest distance, because all shorter paths would go through already-finalized vertices with non-negative edges.
Question 53 of 60 · Kruskal and Prims algorithms to find minimum spanning tree · Hard
For a dense graph with edges, which MST algorithm/implementation is typically most efficient?
Not quite. Try another option.
Answer: Prim's with an adjacency matrix in
For dense graphs , the array-based Prim's is optimal since for Kruskal's and for heap-Prim's are asymptotically larger.
Question 54 of 60 · binary tree · Hard
What is the maximum number of nodes in a binary tree of height (where a single node has height )?
Not quite. Try another option.
Answer:
A perfect binary tree of height has levels through , containing nodes.
Question 55 of 60 · spanning tree · Hard
A connected graph has vertices and edges. The number of edges that must be removed to obtain a spanning tree is:
Not quite. Try another option.
Answer:
A spanning tree has exactly edges. Removing the excess edges (the cyclomatic number) yields a spanning tree.
Question 56 of 60 · minimum spanning tree · Hard
Which statement correctly relates the MST and the shortest-path tree (SPT) rooted at a vertex in a weighted graph?
Not quite. Try another option.
Answer: They can be different trees for the same graph
An MST minimizes total edge weight, while an SPT minimizes distances from a source. These are different objectives, so the two trees generally differ, though they may coincide in special cases.
Question 57 of 60 · shortest path in weighted graphs · Hard
If a weighted directed graph contains a negative-weight cycle reachable from the source, the shortest-path problem:
Not quite. Try another option.
Answer: Is undefined because distances can decrease without bound
Traversing a negative cycle repeatedly reduces path cost indefinitely, so no finite shortest path exists. Algorithms like Bellman-Ford detect such cycles; Dijkstra's cannot even handle negative edges.
Question 58 of 60 · Kruskal and Prims algorithms to find minimum spanning tree · Hard
Both Kruskal's and Prim's algorithms are greedy and correct because they rely on which fundamental principle?
Not quite. Try another option.
Answer: The cut property guarantees the minimum crossing edge is safe to add
Both algorithms add a minimum-weight edge crossing some cut. The cut property proves such an edge belongs to some MST, ensuring the greedy choices build an optimal tree.
Question 59 of 60 · rooted tree · Hard
In a complete -ary rooted tree with internal nodes, the total number of nodes is:
Not quite. Try another option.
Answer:
Each of the internal nodes has children, giving non-root nodes. Adding the single root yields a total of nodes.
Question 60 of 60 · labelled and weighted graph · Hard
In a weighted graph, if a unique edge has strictly the smallest weight, then this edge:
Not quite. Try another option.
Answer: Belongs to every minimum spanning tree
By the cut property, the globally minimum-weight edge crosses some cut as the cheapest crossing edge, so it is safe and must appear in every MST when its weight is strictly the smallest.
That's unit 6
Answer a few questions and your score shows up here.
Nearly through. Did unit 6 of MTH136 save you a night before the exam?
LPU Notes is free. A student pays for the servers.
Did unit 6 of MTH136 save you a night before the exam?
Then you can help keep it free for the next batch. Ads cover part of the server bill;
the rest comes out of a student's own pocket: the domain, the storage, and keeping
the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason.
to try again.