adplus-dvertising

Welcome to the Graphs MCQs Page

Dive deep into the fascinating world of Graphs with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Graphs, a crucial aspect of Data Structures and Algorithms. In this section, you will encounter a diverse range of MCQs that cover various aspects of Graphs, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Data Structures and Algorithms.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Graphs. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Data Structures and Algorithms.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Graphs. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Graphs MCQs | Page 8 of 17

Explore more Topics under Data Structures and Algorithms

Q71.
In the given connected graph G, what is the value of rad(G) and diam(G)?
Discuss
Answer: (a).2, 3
Discuss
Answer: (d).[ [0, 0, 1], [1, 0, 1], [1, 0, 0] ]
Q73.
Given an adjacency matrix A = [ [0, 1, 1], [1, 0, 1], [1, 1, 0] ], how many ways are there in which a vertex can walk to itself using 2 edges.

a.

2

b.

4

c.

6

d.

8

Discuss
Answer: (c).6
Q74.
If A[x+3][y+5] represents an adjacency matrix, which of these could be the value of x and y.
Discuss
Answer: (a).x=5, y=3
Q75.
Two directed graphs(G and H) are isomorphic if and only if A=PBP-1, where P and A are adjacency matrices of G and H respectively.
Discuss
Answer: (a).True
Q76.
Given the following program, what will be the 3rd number that’d get printed in the output sequence for the given input?
#include <bits/stdc++.h> 
using namespace std; 
int cur=0; 
int G[10][10]; 
bool visited[10]; 
deque <int> q; 
 
void fun(int n); 
 
int main()
{   
 int num=0; 
 int n; 
 cin>>n; 
 
 for(int i=0;i<n;i++) 
       for(int j=0;j<n;j++) 
         cin>>G[i][j]; 
 
 for(int i=0;i<n;i++) 
        visited[i]=false; 
 
        fun(n); 
 return 0; 
} 
 
void fun(int n)
{ 
 cout<<cur<<" "; 
 visited[cur]=true; 
 q.push_back(cur); 
 
 do
        { 
  for(int j=0;j<n;j++)
                { 
      if(G[cur][j]==1 && !visited[j])
                    { 
          q.push_back(j); 
          cout<<j<<" "; 
          visited[j]=true; 
             } 
 
                 } 
 
  q.pop_front(); 
  if(!q.empty()) 
  cur=q.front(); 
  }while(!q.empty()); 
}


Input Sequence:-

9 
0 1 0 0 0 0 0 0 1    
1 0 0 0 0 0 0 0 0 
0 0 0 1 1 1 0 0 1 
0 0 1 0 0 0 0 0 0 
0 0 1 0 0 0 0 1 0 
0 0 1 0 0 0 1 0 0 
0 0 0 0 0 1 0 1 1 
0 0 0 0 1 0 1 0 0 
1 0 1 0 0 0 1 0 0

a.

2

b.

6

c.

8

d.

4

Discuss
Answer: (c).8
Q77.
For which type of graph, the given program would run infinitely? The Input would be in the form of an adjacency Matrix and n is its dimension (1<n<10).
#include <bits/stdc++.h> 
using namespace std; 
int G[10][10]; 
void fun(int n); 
 
int main()
{
 int num=0; 
 int n; 
 cin>>n; 
 for(int i=0;i<n;i++) 
   for(int j=0;j<n;j++) 
          cin>>G[i][j]; 
     fun(n); 
 return 0; 
}  
 
void fun(int n)
{ 
 for(int i=0;i<n;i++) 
 for(int j=0;j<n;j++) 
 if(G[i][j]==1) 
 j--; 
}
Discuss
Answer: (b).All Empty Graphs
Q78.
Given the following adjacency matrix of a graph(G) determine the number of components in the G.

[0 1 1 0 0 0],

[1 0 1 0 0 0],

[1 1 0 0 0 0],

[0 0 0 0 1 0],

[0 0 0 1 0 0],

[0 0 0 0 0 0].

a.

1

b.

2

c.

3

d.

4

Discuss
Answer: (c).3
Q79.
Incidence matrix and Adjacency matrix of a graph will always have same dimensions?
Discuss
Answer: (b).False
Q80.
The column sum in an incidence matrix for a simple graph is __________
Discuss
Answer: (c).equal to 2

Suggested Topics

Are you eager to expand your knowledge beyond Data Structures and Algorithms? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!