Q: 1 If a graph has 31 edges and each vertex of the graph has degree atleast 3, then maximum number of possible vertices in the graph is
19
20
21
22
[ Option B ]
We use the Handshaking Theorem, which states that the sum of the degrees of all vertices in an undirected graph equals twice the number of edges:
Sum of degrees of all vertices=2×Number of edges
Here, E=31. So,
Sum of degrees = Sum of degrees=2×31=62
The given condition is that each vertex has degree at least 3. Now, let the number of vertices be n. Then, Sum of degrees ≥ 3n. We already know the exact sum is 62, so, 3n ≤ 62.
Finally solve for n, n ≤ 62/3 = 20.66. Since the number of vertices must be an integer, the maximum possible number of vertices is 20.
Q: 2 Spanning tree of a graph with V vertices has—
V Edges
V+1 Edges
V+2 Edges
V-1 Edges
[ Option D ]
A Spanning Tree of a graph is a subgraph that includes all the vertices of the graph and is connected without forming any cycles. For any connected graph with V vertices, a tree structure must have exactly V-1 edges to remain connected and acyclic.
Q: 3 Consider an undirected un-weighted graph G. Let a breadth first traversal of G be done starting from a node r. let d(r,u) and d(r,v) be the length of the shortest path from r to u and v respectively in G. if u is visited before v during the breadth first traversal, which of the following statement is correct?
D(r,u) < d(r,v)
D (r,u) > d(r,v)
D(r,u) <=d(r,v)
None of the above
[ Option C ]
Q: 4 A graph is a collection of nodes called ________ and line segments called _______ that connect pairs of nodes.
Vertices, Paths
Vertices, Edges
Paths, Edges
Vertices, Vertices
[ Option B ]
In graph theory, a graph is made up of a set of nodes, which are technically called vertices, and a set of line segments that connect pairs of these nodes, which are called edges.
Vertices represent the objects or points in the graph, while edges represent the connections or relationships between them.
Q: 5 A simple graph has
Both parallel edges and self-loops
Self-loops but not parallel edge
Parallel edges but no self-loop
Neither parallel edge nor self-loop
[ Option D ]
A Simple Graph is a type of graph that does not contain any parallel edges (multiple edges) or self-loops (an edge from a vertex to itself). Each edge in a simple graph connects two distinct vertices, and there can be at most one edge between any pair of vertices.
Q: 6 Which of the following is true for adjacency matrix representation of a graph with n vertices?
Space complexity is O(n)
Can not be used for directed graph
Space complexity is O(n2)
Can not be used for weighted graphs
[ Option C ]
In an adjacency matrix, we represent a graph using a two-dimensional array of size n×n, where n is the number of vertices. Each row and column correspond to a vertex, and the value stored in a cell tells us whether an edge exists between two vertices.
If the graph is weighted, the cell stores the weight instead of just 0 or 1. Since the matrix always needs space for n2 entries, the space complexity is O(n2). This representation can be used for directed or undirected graphs as well as weighted or unweighted graphs.
The only drawback is that it uses more memory for sparse graphs, but it provides quick access to check if an edge exists between two vertices.
Q: 7 What are the appropriate data structures for graph traversal using Breadth First Search (BFS) and Depth First Search (DFS) algorithms?
Stack for BFS and Queue for DFS
Queue for BFS and Stack for DFS
Stack for BFS and Stack for DFS
Queue for BFS and Queue for DFS
[ Option B ]
Breadth First Search (BFS) explores a graph level by level, meaning it visits all the neighboring vertices of a node before moving to the next level. To achieve this order, BFS uses a Queue, which follows the First In First Out (FIFO) principle.
Depth First Search (DFS), on the other hand, explores a graph by going as deep as possible along one path before backtracking. This behavior is naturally supported by a Stack, which follows the Last In First Out (LIFO) principle.
Q: 8 For an undirected graph with n vertices and e edges, the sum of the degree of each vertex is:
2n
(2n-1)/2
2e
e2/2
[ Option C ]
In an undirected graph, each edge connects two vertices and contributes 1 degree to each of its end vertices. Therefore, every edge adds a total of 2 to the sum of degrees of all vertices.
If the graph has e edges, the total sum of the degrees of all n vertices becomes 2e. This result is known as the Handshaking Theorem in graph theory.
Q: 9 If V is an isolated vertex in a graph, then the degree of V is:
0
1
2
5
[ Option A ]
An Isolated Vertex in a graph is a vertex that has no edges connected to it. The degree of a vertex is defined as the number of edges connected to that vertex. Since an isolated vertex has no connecting edges, its degree is 0.
Q: 10 Which of the following is not true about a complete graph with n vertices?
Each vertex has degree n-1
It contains no cycle
It is connected
It has n(n-1)/2 edges
[ Option B ]
In graph theory, a Complete Graph is a simple graph in which every pair of distinct vertices is connected by an edge.
Q: 11 Number of vertices of odd degree in a graph is:
Always Even
Always Odd
Either Even or Odd
Always Zero
[ Option A ]
In any graph, the sum of the degrees of all vertices is always even because each edge contributes 2 to the total degree count. As a result, vertices with odd degree must occur in pairs so that their total contribution is even.
Q: 12 The number of edges in a regular graph of degree d and n vertices is—
nd/2
Maximum of n and d
nd
n+d
[ Option A ]
In a Regular Graph, every vertex has the same degree d, meaning each of the n vertices is connected to d edges. If we add the degrees of all vertices, the total becomes n*d.
However, each edge is counted twice in this total. Therefore, to get the actual number of edges, we divide by 2.
Hence, the number of edges in a regular graph with n vertices and degree d is nd/2.
Q: 13 Which of the following is NOT a graph traversal algorithm?
Greedy
Divide and Conquer
Dynamic Programming
None of the above
[ Option D ]
Graph traversal algorithms are specifically methods used to visit all nodes of a graph, such as:
Q: 14 Study the following statements:
Statements:
I- A cycle is an open walk with no repeated vertex.
II- A circuit is a closed walk with no repeated edge.
Which of the following is correct?
Only Statement I is true.
Only Statement II is true.
Both Statement I and II are true.
Neither Statement I nor II is true.
[ Option B ]
A Walk in a graph is a sequence of vertices and edges where each edge connects the previous vertex to the next one. It can repeat vertices or edges, there is no restriction.
In graph theory, a Cycle is a closed walk, meaning it starts and ends at the same vertex, and no other vertices or edges are repeated except the first and last vertex being the same.
A Circuit is indeed a closed walk (starts and ends at the same vertex) where no edge is repeated. Vertices may repeat, but edges do not.
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.