Vidyalelo
Data Structure · all questions

Miscellaneous on Data Structures
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

1,171

Questions

32/59

Page

Pick an option on a question to see the right answer and solution.

What will be the chromatic number of the following graph?
Miscellaneous on Data Structures mcq question image

Select an option to see the answer and solution.

An even length cyclic graph has the edge chromatic number of 3.

Select an option to see the answer and solution.

In Huffman coding, data in a tree always occur?

Select an option to see the answer and solution.

What is the output of the following code?
#include<stdio.h>
int get_len(char *s)
{
      int len = 0;
      while(s[len] != '\0')
        len++;
      return len;
}
int main()
{
      char *s = "";
      int len = get_len(s);
      printf("%d",len);
      return 0;
}

Select an option to see the answer and solution.

Which of the following cipher require the use of tabula recta?

Select an option to see the answer and solution.

Consider the given pseudocode for eulerizing a graph. Which of the following best suits the blank?
Pick up all the vertices of _______  
Repeat edges between the vertices until the graph has no odd degree  
Repeat only pre-existing edges

Select an option to see the answer and solution.

How many steps are required to prove that a decision problem is NP complete?

Select an option to see the answer and solution.

In graphs, in which all vertices have an odd degree, the number of Hamiltonian cycles through any fixed edge is always even.

Select an option to see the answer and solution.

Which of the following cipher is a special case of affine cipher?

Select an option to see the answer and solution.

Tabula recta consists of . . . . . . . .

Select an option to see the answer and solution.

Which is the correct term of the given relation, gcd (a, b) * lcm (a, b) =?

Select an option to see the answer and solution.

A network can have only one source and one sink.

Select an option to see the answer and solution.

What is the output of the following code?
int cnt = 0;
void my_recursive_function(char *s, int i)
{
     if(s[i] == '\0')
        return;
     if(s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u')
     cnt++;
     my_recursive_function(s,i+1);
}
int main()
{
     my_recursive_function("thisisrecursion",0);
     printf("%d",cnt);
     return 0;
}

Select an option to see the answer and solution.

Which of the following ciphered text would have NOT used transposition cipher for encryption of the plain text "CIPHER"?

Select an option to see the answer and solution.

What is the output for the following code?
#include <bits/stdc++.h> 
using namespace std;  
void convert(int a[], int n) 
{ 	
	vector <pair<int, int> > vec;	
	for (int i = 0; i < n; i++) 
		vec.push_back(make_pair(a[i], i)); 
	sort(vec.begin(), vec.end()); 	
	for (int i=0; i<n; i++) 
		a[vec[i].second] = i; 
} 
void printArr(int a[], int n) 
{ 
	for (int i=0; i<n; i++) 
		cout << a[i] << " "; 
} 
int main() 
{ 
	int arr[] = {10,8,2,5,7}; 
	int n = sizeof(arr)/sizeof(arr[0]);  
	convert(arr , n); 
   	printArr(arr, n); 
	return 0; 
}

Select an option to see the answer and solution.

What will be the output if quickselect algorithm is applied to the array arr={1, 5, 4, 3, 7} with k given as 4?

Select an option to see the answer and solution.

In a graph, an independent set is maximal if no further vertex can be added to the stay independent.

Select an option to see the answer and solution.

What does the following code do?
#include<stdio.h>
int cnt = 0;
int recursive_search_num(int *arr, int num, int idx, int len)
{
      int cnt = 0;
      if(idx == len)
      return cnt;
      if(arr[idx] == num)
       cnt++;
      return cnt + recursive_search_num(arr, num, idx+1, len);
}
int main()
{
      int arr[8] ={0,0,0,0,3,5,-6,7},num = 0,len = 8;
      int ans = recursive_search_num(arr,num,0,len);
      printf("%d",ans);
      return 0;
}

Select an option to see the answer and solution.

Which of the following methods can be used to solve n-queen's problem?

Select an option to see the answer and solution.

Consider the following code snippet to find the smallest element in a linked list:
struct Node
{
     int val;
     struct Node* next;
}*head;
int get_min()
{
      struct Node* temp = head->next;
	  int min_num = temp->val;
	  while(temp != 0)
	  {
	       if(_________)
		    min_num = temp->val;
		temp = temp->next;
	  }
	  return min_num;
}
Which of the following lines should be inserted to complete the above code?

Select an option to see the answer and solution.