SRM INSTITUTE OF SCIENCE AND TECHNOLOGY Ramapuram Campus, Bharathi Salai, Ramapuram, Chennai - 600089 COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK DEGREE / BRANCH: B.TECH. / CSE III SEMESTER SUB CODE & NAME: 21CSC201J & DATA STRUCTURES AND ALGORITHMS Regulation– 2021 Academic Year 2023-2024 SRM INSTITUTE OF SCIENCE AND TECHNOLOGY Ramapuram Campus, Bharathi Salai, Ramapuram, Chennai-600089 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTIONBANK SUBJECT : 18CSC201J- DATA STRUCTURES AND ALGORITHMS SEM/YEAR:III/II Course Outcomes CO1: Identify linear and non-linear data structures. Create algorithms for searching and sorting CO2: Create the different types of linked lists and evaluate its operations CO3: Construct stack and queue data structures and evaluate its operations CO4: Create tree data structures and evaluate its types and operations CO5: Create graph data structure, evaluate its operations, implement algorithms to identify shortest path UNIT V Introduction to Graph, Graph Traversal, Topological sorting, Minimum spanning tree – Prims Algorithm, Kruskal’s Algorithm, Shortest Path Algorithm - Dijkstra’s Algorithm PART-A (Multiple Choice Questions) Course Competence Q. Questions BT Level Outcome No Other name for directed graph is .......... 1 a) Direct graph b) Digraph CO5 BT2 c) Dir-graph d) Digraph Ans:D 2 3 4 Graph G is .............. (V,E) whereV(G) represents set of vertices and E(G) represents setoff edges. a) Leterally connected b) Widely Connected c) Ordered set d) Literally connected Ans:C The vertex with zero degree........ a) Isolated vertex b) no cycle graph c) non cycle graph d) circular graph Ans:A The vertex with degree one........ a) A tree graph CO5 BT2 CO5 BT2 CO5 BT2 5 6 7 8 9 10 b) Free tree c) A tree d d) pendant vertex Ans:D In a graph if e=[u,v], Then u and v are called ........ a) End points of e b) Adjacent nodes c) Neighbours d) All of the above Ans:D A Graph is a collection of ____ a) row and columns b) Vetices and edges c) Equations d) None of these Ans:B A Graph G is called_____ if all nodes are fully connected a) Cyclic graph b) Complete graph c) Not a graph d) Regular graph Ans:B Topological sorting for Directed Acyclic Graph (DAG) is a ______ ordering of vertices a) Ascending b) Decending c) Linear d) Non Linear Ans:B Topological Sorting for a graph is not possible if the graph is not a _____ a) Directed Acyclic Graph (DAG) b) Directed Graph c) Linear d) Non Linear Ans:A Which of the following is/are the operations performed by kruskal’s algorithm? i)sort the edges of G in increasing order by length ii)keep a subgraph S of G initially empty iii)builds a tree one vertex at a time a) i, and ii only b) ii and iii only c) i and iii only d) All i, ii and iii Ans:A CO5 BT2 CO5 BT2 CO5 BT2 CO5 BT2 CO5 BT2 CO5 BT1 11 12 13 14 15 16 17 .……………… is known as a greedy algorithm, because it chooses at each step the cheapest edge to add to subgraph S. a) Kruskal’s algorithm b) Prim’s algorithm c) Dijkstra algorithm d) Bellman ford algorithm Ans :A Dijkstra’s Algorithm cannot be applied on ______________ a) A Directed and weighted graphs b) Graphs having negative weight function c) Unweighted graphs d) Undirected and unweighted graphs ANS:B How many priority queue operations are involved in Dijkstra’s Algorithm? a) 1 b) 3 c) 2 d) 4 Ans:b The maximum number of times the decrease key operation performed in Dijkstra’s algorithm will be equal to ___________ a) Total number of vertices b) Total number of edges c) Number of vertices – 1 d) Number of edges – 1 Ans:b Dijkstra’s Algorithm is the prime example for ___________ a) Greedy algorithm b) Branch and bound c) Back tracking d) Dynamic programmin Ans:b Prim’s algorithm is a ______ a) Divide and conquer algorithm b) Greedy algorithm c) Dynamic Programming d) Approximation algorithm Ans:b Which of the following is false about Prim’s algorithm? a) It is a greedy algorithm b) It constructs MST by selecting edges in increasing order of their weights c) It never accepts cycles in the MST d) It can be implemented using the Fibonacci heap Ans:b CO5 BT2 CO5 BT4 CO5 BT1 CO5 BT4 CO5 BT2 CO5 BT2 CO5 BT1 18 19 20 21 22 23 24 25 Kruskal’s algorithm is used to ______ a) find minimum spanning tree b) find single source shortest path c) find all pair shortest path algorithm d) traverse the graph Ans:a Topological sort can be applied to which of the following graphs? a) Undirected Cyclic Graphs b) Directed Cyclic Graphs c) Undirected Acyclic Graphs d) Directed Acyclic Graphs Ans:d In most of the cases, topological sort starts from a node which has __________ a) Maximum Degree b) Minimum Degree c) Any degree d) Zero Degree Ans: d Cost Efficient Time Complexity of Topological Sorting is? (V – number of vertices, E – number of edges) a) O(V + E) b) O(V) c) O(E) d) O(V*E) Ans: a) 1. Which alternative algorithm is used when negative-weight edges are present in the graph? a) Floyd-Warshall algorithm b) Kruskal's algorithm c) Breadth-First Search (BFS) d) Bellman-Ford algorithm Ans: d In Dijkstra's algorithm, how are the initial distances set for all vertices? a) All distances are set to 1 b) All distances are set to infinity c) All distances are set to 0 d) Distances are determined randomly Ans: b In which type of graphs does Dijkstra's algorithm perform well? a) Dense graphs b) Sparse graphs c) Directed graphs d) Bipartite graphs Ans: b Consider the following graph. Using Kruskal’s algorithm, which edge will be selected first? What is the primary objective of a shortest path algorithm? a) To find the longest path in a graph CO5 BT2 CO5 BT1 C05 BT2 CO5 BT2 CO5 BT1 CO5 BT1 CO5 BT1 CO5 BT2 b) To find the path with the most edges c) To find the shortest path between two vertices in a graph d) To find all possible paths in a graph Ans: c PART B (4 Marks) 1 Define Graph? CO5 BT1 2 Write short notes on adjacent nodes. CO5 BT4 3 What is the use of Kruskal’s algorithm and who discovered it? CO5 BT1 4 Compare indegree and out degree of a graph. CO5,CO6 BT4 5 What is an undirected graph? CO5 BT1 6 What is a directed graph? CO5 BT1 7 What is meant by strongly connected in a graph? CO5 BT1 8 Discuss the BFS and DFS differences CO5 BT6 1 PART C (12 Marks) Explain the various representation of graph with example in detail? CO5 BT2 CO5 BT1 CO5 BT3 CO5 BT2 CO5 BT3 2 3 4 5 What is topological sort? Write an algorithm to perform topological sort? Construct the steps for implementing Dijkstra’s algorithm with an example. Explain the Graph traversal BFS and DFS in detail. Construct the minimum spanning tree with suitable example in both Krsukal and Prim’s method Note: 1. BT Level – Blooms Taxonomy Level 2. CO – Course Outcomes BT1 –Remember BT2 – Understand BT3 – Apply BT4 – Analyze BT5 – Evaluate BT6 – Create