Algorithm multiple choice questions part-5

Graph MCQs Questions:-

1. What is a graph in computer science? a. A data structure consisting of nodes and edges. b. A data structure consisting of nodes only. c. A data structure consisting of edges only. d. A data structure consisting of nodes, edges, and weights.

1. What are the two components of a graph? a. Nodes and weights b. Edges and weights c. Nodes and edges d. Nodes and costs

1. What is an adjacency matrix? a. An array of linked lists used to represent a graph. b. A 2D array of size V x V used to represent a graph. c. A list of nodes used to represent a graph. d. A list of edges used to represent a graph.

1. What is an adjacency list? a. A 2D array of size V x V used to represent a graph. b. An array of linked lists used to represent a graph. c. A list of nodes used to represent a graph. d. A list of edges used to represent a graph.

1. What is the difference between (u, v) and (v, u) in a directed graph? a. There is no difference. b. (u, v) means there is an edge from u to v, while (v, u) means there is an edge from v to u. c. (u, v) means there is an edge from v to u, while (v, u) means there is an edge from u to v. d. (u, v) means there is a node u and a node v, while (v, u) means there is a node v and a node u.

1. What is the time complexity of breadth-first traversal for a graph using an adjacency list representation? a. O(V) b. O(E) c. O(V+E) d. O(V * V)

1. What is the time complexity of breadth-first traversal for a graph using an adjacency matrix representation? a. O(V) b. O(E) c. O(V+E) d. O(V * V)

1. What is the time complexity of depth-first traversal for a graph using an adjacency list representation? a. O(V) b. O(E) c. O(V+E) d. O(V * V)

1. What is the time complexity of depth-first traversal for a graph using an adjacency matrix representation? a. O(V) b. O(E) c. O(V+E) d. O(V * V)

1. What is Dijkstra’s shortest path algorithm used for? a. Finding the longest path in a graph. b. Finding the shortest path in a directed acyclic graph. c. Finding the shortest path in a weighted graph. d. Finding the longest path in a directed acyclic graph.

1. What is the time complexity of Dijkstra’s shortest path algorithm using an adjacency matrix representation? a. O(V log V) b. O(E log V) c. O(V^2) d. O(E^2)

1. What is the time complexity of Dijkstra’s shortest path algorithm using an adjacency list representation? a. O(V log V) b. O(E log V) c. O(V^2) d. O(E^2)

Pre  ðŸ‘ˆ                                ðŸ‘‰  Next