Explore topic-wise MCQs in Data Structures and Algorithms.

This section includes 17 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structures and Algorithms knowledge and support exam preparation. Choose a topic below to get started.

1.

Given the following adjacency matrix of a graph(G) determine the number of components in the G.

A. 1
B. 2
C. 3
D. 4View Answer
Answer» D. 4View Answer
2.

For which type of graph, the given program won’t run infinitely? The Input would be in the form of an adjacency Matrix and n is its dimension (1

A. All Fully Connected Graphs
B. All Empty Graphs
C. All Bipartite Graphs
D. All simple graphsView Answer
Answer» C. All Bipartite Graphs
3.

Given the following program, what will be the 3rd number that’d get printed in the output sequence for the given input?

A. 2
B. 6
C. 8
D. 4View Answer
Answer» D. 4View Answer
4.

If A[x+3][y+5] represents an adjacency matrix, which of these could be the value of x and y.

A. x=5, y=3
B. x=3, y=5
C. x=3, y=3
D. x=5, y=5
Answer» B. x=3, y=5
5.

Given an adjacency matrix A = [ [0, 1, 1], [1, 0, 1], [1, 1, 0] ], The total no. of ways in which every vertex can walk to itself using 2 edges is ________

A. 2
B. 4
C. 6
D. 8
Answer» D. 8
6.

Which of these adjacency matrices represents a simple graph?

A. [ [1, 0, 0], [0, 1, 0], [0, 1, 1] ]
B. [ [1, 1, 1], [1, 1, 1], [1, 1, 1] ]
C. [ [0, 0, 1], [0, 0, 0], [0, 0, 1] ]
D. [ [0, 0, 1], [1, 0, 1], [1, 0, 0] ]
Answer» E.
7.

If A[x+3][y+5] represents an adjacency matrix, which of these could be the value of x and y.$

A. x=5, y=3
B. x=3, y=5
C. x=3, y=3
D. x=5, y=5
Answer» B. x=3, y=5
8.

Given an adjacency matrix A = [ [0, 1, 1], [1, 0, 1], [1, 1, 0] ], how many ways are there in which a vertex can walk to itself using 2 edges.$

A. 2
B. 4
C. 6
D. 8
Answer» D. 8
9.

Two directed graphs(G and H) are isomorphic if and only if A=PBP-1, where P and A are adjacency matrices of G and H respectively.

A. True
B. False
Answer» B. False
10.

In the given connected graph G, what is the value of rad(G) and diam(G)?

A. 2, 3
B. 3, 2
C. 2, 2
D. 3, 3
Answer» B. 3, 2
11.

On which of the following statements does the time complexity of checking if an edge exists between two particular vertices is not, depends?

A. Depends on the number of edges
B. Depends on the number of vertices
C. Is independent of both the number of edges and vertices
D. It depends on both the number of edges and vertices
Answer» D. It depends on both the number of edges and vertices
12.

What is the maximum number of possible non zero values in an adjacency matrix of a simple graph with n vertices?

A. (n*(n-1))/2
B. (n*(n+1))/2
C. n*(n-1)
D. n*(n+1)
Answer» D. n*(n+1)
13.

For the adjacency matrix of a directed graph the row sum is the _________ degree and the column sum is the ________ degree.

A. in, out
B. out, in
C. in, total
D. total, out
Answer» C. in, total
14.

The time complexity to calculate the number of edges in a graph whose information in stored in form of an adjacency matrix is ____________

A. O(V)
B. O(E<sup>2</sup>)
C. O(E)
D. O(V<sup>2</sup>)
Answer» E.
15.

Adjacency matrix of all graphs are symmetric.

A. False
B. True
Answer» B. True
16.

What would be the number of zeros in the adjacency matrix of the given graph?

A. 10
B. 6
C. 16
D. 0
Answer» C. 16
17.

The number of elements in the adjacency matrix of a graph having 7 vertices is __________

A. 7
B. 14
C. 36
D. 49
Answer» E.