ADV Midterm 2 Review

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

If a simple graph G, contains n vertices and m edges, the number of edges in the Graph G'(Complement of G) is ___________ a) (n*n-n-2*m)/2 b) (n*n+n+2*m)/2 c) (n*n+n-2*m)/2 d) (n*n-n+2*m)/2

a) (n*n-n-2*m)/2

For which of the following combinations of the degrees of vertices would the connected graph be eulerian? a) 1,2,3 b) 2,3,4 c) 2,4,5 d) 1,3,5

a) 1,2,3

Which of the following is false? a) A B+ -tree grows downwards b) A B+ -tree is balanced c) In a B+ -tree, the sibling pointers allow sequential searching d) B+ -tree is shallower than B-tree

a) A B+ -tree grows downwards

Which of the following is true? a) A graph may contain no edges and many vertices b) A graph may contain many edges and no vertices c) A graph may contain no edges and no vertices d) None of the mentioned

a) A graph may contain no edges and many vertices

Regarding implementation of Depth First Search using stacks, what is the maximum distance between two nodes present in the stack? (considering each edge length 1) a) Can be anything b) 0 c) At most 1 d) Insufficient Information

a) Can be anything

A person wants to visit some places. He starts from a vertex and then wants to visit every vertex till it finishes from one vertex, backtracks and then explore other vertex from same vertex. What algorithm he should use? a) Depth First Search b) Breadth First Search c) Trim's algorithm d) None of the mentioned

a) Depth First Search

A B+ -tree of order 3 is generated by inserting 89, 9 and 8. The generated B+ -tree is __________ a) b) c) d)

b

What is the number of edges present in a complete graph having n vertices? a) (n*(n+1))/2 b) (n*(n-1))/2 c) n d) Information given is insufficient

b) (n*(n-1))/2

A B+ tree can contain a maximum of 7 pointers in a node. What is the minimum number of keys in leaves? a) 6 b) 3 c) 4 d) 7

b) 3

A connected planar graph having 6 vertices, 7 edges contain _____________ regions. a) 15 b) 3 c) 1 d) 11

b) 3

Given a directed graph where weight of every edge is same, we can efficiently find shortest path from a given source to destination using? (A) Breadth First Traversal (B) Dijkstra's Shortest Path Algorithm (C) Neither Breadth First Traversal nor Dijkstra's algorithm can be used (D) Depth First Search

(A) Breadth First Traversal

Traversal of a graph is different from tree because (A) There can be a loop in graph so we must maintain a visited flag for every vertex (B) DFS of a graph uses stack, but in-order traversal of a tree is recursive (C) BFS of a graph uses queue, but a time efficient BFS of a tree is recursive. (D) All of the above

(A) There can be a loop in graph so we must maintain a visited flag for every vertex

What is the maximum number of edges in an acyclic undirected graph with n vertices? (A) n-1 (B) n (C) n + 1 (D) 2n-1

(A) n-1

Given an undirected graph G with V vertices and E edges, the sum of the degrees of all vertices is (A) E (B) 2E (C) V (D) 2V

(B) 2E

Consider a weighted complete graph G on the vertex set {v1,v2 ,v} such that the weight of the edge (v,,v) is 2|i-j|. The weight of a minimum spanning tree of G is: (A) n — 1 (B) 2n — 2 (C) nC2 (D) 2

(B) 2n — 2

Which of the following condition is sufficient to detect cycle in a directed graph? (A) There is an edge from currently being visited node to an already visited node.(B) There is an edge from currently being visited node to an ancestor of currently visited node in DFS forest. (C) Every node is seen twice in DFS. (D) None of the above

(B) There is an edge from currently being visited node to an ancestor of currently visited node in DFS forest.

Given two vertices in a graph s and t, which of the two traversals (BFS and DFS) can be used to find if there is path from s to t? (A) Only BFS (B) Only DFS (C) Both BFS and DFS (D) Neither BFS nor DFS

(C) Both BFS and DFS

Which of the following algorithm can be used to efficiently calculate single source shortest paths in a Directed Acyclic Graph? (A) Dijkstra (B) Bellman-Ford (C) Topological Sort (D) Strongly Connected Component

(C) Topological Sort

Match Group A and Group B; Group A Group B a) Dijkstra's single shortest path algo p) Dynamic Programming b) Bellmen Ford's single shortest path algo q) Backtracking c) Floyd Warshall's all pair shortest path algo. r) Greedy Algorithm (A) a-r, b-q, c-p (B) a-p, b-p, c-p (C) a-r, b-p, c-p (D) a-p,b-r, c-q

(C) a-r, b-p, c-p

In an unweighted, undirected connected graph, the shortest path from a node S to every other node is computed most efficiently, in terms of time complexity by (A) Dijkstra's algorithm starting from S. (B) Warshall's algorithm (C) Performing a DFS starting from S. (D) Performing a BFS starting from S.

(D) Performing a BFS starting from S.

The Breadth First Search algorithm has been implemented using the queue data structure. One possible order of visiting the nodes of the following graph is A. MNOPQR B. NQMPOR C. QMNPRO D. QMNPOR

C. QMNPRO

Which of the following statements for a simple graph is correct? a) Every path is a trail b) Every trail is a path c) Every trail is a path as well as every path is a trail d) None of the mentioned

a) Every path is a trail

Adjacency matrix of all graphs are symmetric. a) False b) True

a) False

Which of the following properties does a simple graph not hold? a) Must be connected b) Must be unweighted c) Must have no loops or multiple edges d) All of the mentioned

a) Must be connected

Most 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) None of the mentioned

a) O(V + E)

Time complexity to find if there is an edge between 2 particular vertices is _________ a) O(V) b) O(E) c) O(1) d) O(V+E)

a) O(V)

Depth First Search is equivalent to which of the traversal in the Binary Trees? a) Pre-order Traversal b) Post-order Traversal c) Level-order Traversal d) In-order Traversal

a) Pre-order Traversal

Topological sort is equivalent to which of the traversals in trees? a) Pre-order traversal b) Post-order traversal c) In-order traversal d) Level-order traversal

a) Pre-order traversal

The Data structure used in standard implementation of Depth First Search is? a) Stack b) Queue c) Linked List d) None of the mentioned

a) Stack

Statement 1: When a node is split during insertion, the middle key is promoted to the parent as well as retained in right half-node.Statement 2: When a key is deleted from the leaf, it is also deleted from the non-leaf nodes of the tree. a) Statement 1 is true but statement 2 is false b) Statement 2 is true but statement 1 is false c) Both the statements are true d) Both the statements are false

a) Statement 1 is true but statement 2 is false

For some sparse graph an adjacency list is more space efficient against an adjacency matrix. a) True b) False

a) True

The given Graph is regular. a) True b) False

a) True

For the given conditions, which of the following is in the correct order of increasing space requirement?i) Undirected, no weightii) Directed, no weightiii) Directed, weightediv) Undirected, weighted a) ii iii i iv b) i iii ii iv c) iv iii i ii d) i ii iii iv

a) ii iii i iv

A person wants to visit some places. He starts from a vertex and then wants to visit every place connected to this vertex and so on. What algorithm he should use? a) Depth First Search b) Breadth First Search c) Trim's algorithm d) None of the mentioned

b) Breadth First Search

In a B+ tree, both the internal nodes and the leaves have keys. a) True b) False

b) False

In a simple graph, the number of edges is equal to twice the sum of the degrees of the vertices. a) True b) False

b) False

Topological sort starts from a node which has? a) Maximum Degree b) Minimum Degree c) Any degree d) None of the mentioned

b) Minimum Degree

The Data structure used in standard implementation of Breadth First Search is? a) Stack b) Queue c) Linked List d) None of the mentioned

b) Queue

A graph with all vertices having equal degree is known as a __________ a) Multi Graph b) Regular Graph c) Simple Graph d) Complete Graph

b) Regular Graph

In which case adjacency list is preferred in front of an adjacency matrix? a) Dense graph b) Sparse graph c) Adjacency list is always preferred d) None of the mentioned

b) Sparse graph

The Breadth First Search traversal of a graph will result into? a) Linked List b) Tree c) Graph with back edges d) All of the mentioned

b) Tree

The Depth First Search traversal of a graph will result into? a) Linked List b) Tree c) Graph with back edges d) None of the mentioned

b) Tree

When the Breadth First Search of a graph is unique? a) When the graph is a Binary Tree b) When the graph is a Linked List c) When the graph is a n-ary Tree d) None of the mentioned

b) When the graph is a Linked List

When the Depth First Search of a graph is unique? a) When the graph is a Binary Tree b) When the graph is a Linked List c) When the graph is a n-ary Tree d) None of the mentioned

b) When the graph is a Linked List

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

b) out, in

For a given graph G having v vertices and e edges which is connected and has no cycles, which of the following statements is true? a) v=e b) v = e+1 c) v + 1 = e d) None of the mentioned

b) v = e+1

What is the maximum number of edges in a bipartite graph having 10 vertices? a) 24 b) 21 c) 25 d) 16

c) 25

Which of the following ways can be used to represent a graph? a) Adjacency List and Adjacency Matrix b) Incidence Matrix c) Adjacency List, Adjacency Matrix as well as Incidence Matrix d) None of the mentioned

c) Adjacency List, Adjacency Matrix as well as Incidence Matrix

Regarding implementation of Breadth First Search using queues, what is the maximum distance between two nodes present in the queue? (considering each edge length 1) a) Can be anything b) 0 c) At most 1 d) Insufficient Information

c) At most 1

Which of the following is true? a) B + tree allows only the rapid random access b) B + tree allows only the rapid sequential access c) B + tree allows rapid random access as well as rapid sequential access d) B + tree allows rapid random access and slower sequential access

c) B + tree allows rapid random access as well as rapid sequential access

Which one of the following data structures are preferred in database-system implementation? a) AVL tree b) B-tree c) B+ -tree d) Splay tree

c) B+ -tree

Which of the following is false? a) Compared to B-tree, B+ -tree has larger fanout b) Deletion in B-tree is more complicated than in B+ -tree c) B+ -tree has greater depth than corresponding B-tree d) Both B-tree and B+ -tree have same search and insertion efficiencies

c) B+ -tree has greater depth than corresponding B-tree

In Depth First Search, how many times a node is visited? a) Once b) Twice c) Equivalent to number of indegree of the node d) None of the mentioned

c) Equivalent to number of indegree of the node

On which of the following statements does the time complexity of checking if an edge exists between two 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

c) Is independent of both the number of edges and vertices

Breadth First Search is equivalent to which of the traversal in the Binary Trees? a) Pre-order Traversal b) Post-order Traversal c) Level-order Traversal d) In-order Traversal

c) Level-order Traversal

Space complexity for an adjacency list of an undirected graph having large values of V (vertices) and E (edges) is ___________ a) O(E) b) O(V*V) c) O(E+V) d) O(V)

c) O(E+V)

Topological sort of a Directed Acyclic graph is? a) Always unique b) Always Not unique c) Sometimes unique and sometimes not unique d) None of the mentioned

c) Sometimes unique and sometimes not unique

For the given graph(G), which of the following statements is true? a) G is a complete graph b) G is not a connected graph c) The vertex connectivity of the graph is 2 d) The edge connectivity of the graph is 1

c) The vertex connectivity of the graph is 2

A man wants to go different places in the world. He has listed them down all. But there are some places where he wants to visit before some other places. What application of graph can he use to determine that? a) Depth First Search b) Breadth First Search c) Topological Sorting d) Dijkstra's Shortest path algorithm

c) Topological Sorting

Topological sort can be implemented by? a) Using Depth First Search b) Using Breadth First Search c) Using Depth and Breadth First Search d) None of the mentioned

c) Using Depth and Breadth First Search

In BFS, how many times a node is visited? a) Once b) Twice c) equivalent to number of indegree of the node d) None of the mentioned

c) equivalent to number of indegree of the node

The topological sorting of any DAG can be done in ________ time. a) cubic b) quadratic c) linear d) logarithmic

c) linear

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)

c) n*(n-1)

Complete the given snippet of code for the adjacency list representation of a weighted directed graph. class neighbor { int vertex, weight; ____ next; } class vertex { string name; _____ adjlist; } vertex adjlists[101]; a) vertex, vertex b) neighbor, vertex c) neighbor, neighbor d) vertex, neighbor

c) neighbor, neighbor

Given two vertices in a graph s and t, which of the two traversals (BFS and DFS) can be used to find if there is path from s to t? a. Only BFS b. Only DFS c. Both BFS and DFS d. Neither BFS nor DFS

c. Both BFS and DFS

What is the maximum number of keys that a B+ -tree of order 3 and of height 3 have? a) 3 b) 80 c) 27 d) 26

d) 26

The number of elements in the adjacency matrix of a graph having 7 vertices is __________ a) 7 b) 14 c) 36 d) 49

d) 49

What can be the applications of topological sorting? a) Finding prerequisite of a task b) Finding Deadlock in an Operating System c) Finding Cycle in a graph d) All of the mentioned

d) All of the mentioned

What can be the applications of Breadth First Search?a) Finding shortest path between two nodes b) Finding bipartiteness of a graph c) GPS navigation system d) All of the mentioned

d) All of the mentioned Explanation: Breadth First Search can be applied to all the mentioned problems. Bipartiteness of a graph means that a graph can be divided into two disjoint sets such that every edge connects a vertex in to one in.

What can be the applications of Depth First Search? a) For generating topological sort of a graph b) For generating Strongly Connected Components of a directed graph c) Detecting cycles in the graph d) All of the mentioned

d) All of the mentioned Explanation: Depth First Search can be applied to all of the mentioned problems.

In the given graph identify the cut vertices. a) B and E b) C and D c) A and E d) C and B

d) C and B

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

d) Directed Acyclic Graphs

Efficiency of finding the next record in B+ tree is ____ a) O(n) b) O(log n) c) O(nlog n) d) O(1)

d) O(1)

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(E2) c) O(E) d) O(V2)

d) O(V2)


Kaugnay na mga set ng pag-aaral

Kaplan - Maternity Gynecology A,B,C,

View Set

The American Pageant Terms, AP US History Princeton Study Review - Princeton Review, APUSH Period 3-7 Review 2020 Exam

View Set

Current Issues in Maternal-Newborn Nursing

View Set

chapter eleven: the diversity of bacteria and archaea

View Set