Independent Set Problem Multiple Choice Questions and Answers (MCQs)

This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “Independent Set Problem”.

1. Which of the following refers to the set of non-adjacent vertices?
a) Independent set
b) Dominant set
c) Vertex cover set
d) Edge cover set
View Answer

Answer: a
Explanation: In a graph G with V vertices and E edges, there exists a set of vertices, in which no two vertices are adjacent. This set of non-adjacent vertices is called an independent set i.e. no two vertices share a common edge.

2. Which of the following refers to the independence number of a graph?
a) Smallest size of a maximal independent set
b) Largest size of a minimal independent set
c) Smallest size of a minimal independent set
d) Largest size of a maximal independent set
View Answer

Answer: d
Explanation: In a graph G=(V, E) a subset S is an independent set if no two vertices in the S are adjacent. The independence number of graph G is the cardinality of the largest size of an independent set of vertices.

3. Given below is the pseudocode of the independent set problem. Which of the following best suits the blank?

advertisement
advertisement
Independent (G = (V, E))
{
    temp=true
    for every {u, v} in the subset
    {
        check if they have any edge between them
        if edge exist, then set ________________
    }
    If temp is true   
    correct result        
    else 
incorrect
}

a) temp to true and continue
b) temp to true and break
c) temp to false and break
d) temp to false and continue
View Answer

Answer: c
Explanation: The given pseudocode is for solving the independent set problem. First, initialize a temporary variable as true. Now, check that each pair of vertices belong to the set are adjacent or not, by checking if there exists any edge between them.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

4. What is the maximal independent set for the graph given below?
Find the maximal independent set for the given graph
a) {C, D, E, G}
b) {A, C, D, F}
c) {A, E, B, C}
d) {A, B, C, D}
View Answer

Answer: b
Explanation: The maximal independent set S of a graph G contains the set of vertices, such that no two vertices should be adjacent and no vertex can be further added to the set. If we start with vertex A, we can’t select vertex B. Select vertex C and D, hence we can’t select E. Now, select any vertex from F and G according to the given options. Hence, the set contains the vertex {A, C, D, F}.

5. In a graph, an independent set is maximal if no further vertex can be added to the stay independent.
a) True
b) False
View Answer

Answer: a
Explanation: In a given graph G=(V, E), an independent set of G is a subset S of the vertices present in the graph G, such that no two vertices of S are adjacent in G. Hence, a maximal independent set of graph G is a set where it is impossible to add another vertex and stay independent.
advertisement

6. What is the independence number of the graph given below?
Find the independence number of the graph
a) 1
b) 2
c) 3
d) 4
View Answer

Answer: c
Explanation: The independence number of the graph is given by the largest size of an independent set. If we start with vertex A, we can’t select vertex B. Select vertex C and vertex E. The maximal independent set of the graph will be {A, C, E}. Hence, the independence number of the graph is 3.

7. What is the size of the smallest maximal independent set of a chain of 7 nodes?
a) 1
b) 2
c) 3
d) 4
View Answer

Answer: c
Explanation: In a graph G, a set of vertices is an independent set if there is no common edge between them. A maximal independent set of graph G is a set where it is impossible to add another vertex to make it independent. Here, we can select the 2nd, 5th and 7th node to get the smallest maximal independent set (1—2—3—4—5—6—7). Hence, the size of smallest maximal independent set of a chain of 7 nodes is 3.
advertisement

8. The pseudocode for the independent set problem is given below. Which of the following gives the time complexity for it?

Independent (G = (V, E))
{
    temp=true
    for every {u, v} in the subset
    {
        check if they have any edge between them
        if edge exists, then set temp as false and break
    }
    If temp is true 
    correct result        
    else 
incorrect
}

a) O(V + E)
b) O(V)
c) O(V log V)
d) O(V log E)
View Answer

Answer: a
Explanation: To check whether the given subset of vertices of a given graph is an independent set, we need to check that all the vertices present in the set are non-adjacent. This can be done by confirming that they don’t share any edge. This can be performed in polynomial time. Hence, the time complexity is O(V + E).

Sanfoundry Global Education & Learning Series – Data Structures & Algorithms.

To practice all areas of Data Structures & Algorithms, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.