Site icon T4Tutorials.com

Graph representation (adjacency matrix, adjacency list) MCQs

1. What is an adjacency matrix?

(A) A 1D array representing graph edges


(B) A 2D array representing graph connections


(C) A list of edges


(D) A tree structure



2. Which representation is more space-efficient for sparse graphs?

(A) Adjacency matrix


(B) Adjacency list


(C) Both are equally efficient


(D) None of the above



3. In an adjacency matrix, what does a value of 1 indicate?

(A) No edge exists


(B) An edge exists


(C) The graph is directed


(D) The graph is weighted



4. What is the time complexity of checking for the existence of an edge using an adjacency matrix?

(A) O(1)


(B) O(n)


(C) O(n²)


(D) O(log n)



5. What is the primary disadvantage of using an adjacency matrix for graph representation?

(A) It is complex to implement


(B) It uses too much memory for sparse graphs


(C) It does not support weighted graphs


(D) It cannot represent directed graphs



6. Which of the following is true about adjacency lists?

(A) They require more memory than adjacency matrices


(B) They can represent both directed and undirected graphs


(C) They are slower for edge existence checks


(D) They cannot represent weighted graphs



7. For a complete graph with n vertices, what is the size of the adjacency matrix?

(A) n


(B) n²


(C) n(n−1)/2


(D) 2n



8. How can you represent weights in an adjacency matrix?

(A) Use negative numbers


(B) Replace 1s with the weight values


(C) Add an extra row


(D) Use a separate array



9. What is the time complexity of traversing all vertices in an adjacency list?

(A) O(1)


(B) O(n)


(C) O(n + e) where e is the number of edges


(D) O(n²)



10. Which representation is more suitable for dense graphs?

(A) Adjacency list


(B) Adjacency matrix


(C) Edge list


(D) None of the above



 

 

Data Structures MCQs

Basic Concepts

  1. Introduction to Data Structures
  2. Complexity Analysis MCQs

Linear Data Structures MCQs

  1. Arrays MCQs
  2. Linked Lists MCQs
  3. Stacks MCQs
  4. Queues MCQs

Non-Linear Data Structures MCQs

  1. Trees MCQs
  2. Heaps MCQs
  3. Graphs MCQs

Hashing MCQs MCQs

  1. Hash Tables

Sorting and Searching Algorithms MCQs 

  1. Sorting Algorithms MCQs
  2. Searching Algorithms MCQs

Miscellaneous

  1. Memory Management in data structures MCQs
  2. String Manipulation Algorithms MCQs
  1. Data Structures MCQs 1
  2. Data Structures MCQs 2
  3. Data Structures MCQs 3
  4. Data Structures MCQs 4
  5. Data Structures MCQs 5
  6. Stacks Solved MCQs
  7. Queues MCQs
  8. pointer mcqs
  9. Array MCQs

 

Exit mobile version