A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

71. In the given connected graph G, what is the value of rad(G) and diam(G)?
a. 2, 3
b. 3, 2
c. 2, 2
d. 3, 3
View Answer Report Discuss Too Difficult!
Answer: (a).2, 3

72. Which of these adjacency matrices represents a simple graph?
a. [ [1, 0, 0], [0, 1, 0], [0, 1, 1] ]
b. [ [1, 1, 1], [1, 1, 1], [1, 1, 1] ]
c. [ [0, 0, 1], [0, 0, 0], [0, 0, 1] ]
d. [ [0, 0, 1], [1, 0, 1], [1, 0, 0] ]
View Answer Report Discuss Too Difficult!
Answer: (d).[ [0, 0, 1], [1, 0, 1], [1, 0, 0] ]

73. 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
View Answer Report Discuss Too Difficult!
Answer: (c).6

74. If A[x+3][y+5] represents an adjacency matrix, which of these could be the value of x and y.
a. x=5, y=3
b. x=3, y=5
c. x=3, y=3
d. x=5, y=5
View Answer Report Discuss Too Difficult!
Answer: (a).x=5, y=3

75. 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.
a. True
b. False
c. May be
d. Can't say
View Answer Report Discuss Too Difficult!
Answer: (a).True

76. 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
View Answer Report Discuss Too Difficult!
Answer: (c).8

77. 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--; 
}
a. All Fully Connected Graphs
b. All Empty Graphs
c. All Bipartite Graphs
d. None of the Mentioned
View Answer Report Discuss Too Difficult!
Answer: (b).All Empty Graphs

78. 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
View Answer Report Discuss Too Difficult!
Answer: (c).3

79. Incidence matrix and Adjacency matrix of a graph will always have same dimensions?
a. True
b. False
c. May be
d. Can't say
View Answer Report Discuss Too Difficult!
Answer: (b).False

80. The column sum in an incidence matrix for a simple graph is __________
a. depends on number of edges
b. always greater than 2
c. equal to 2
d. equal to the number of edges
View Answer Report Discuss Too Difficult!
Answer: (c).equal to 2