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

33/59

Page

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

What is the total block length 'n' of a Hamming code?

Select an option to see the answer and solution.

What will be the plain text corresponding to cipher text "EETPEG" if gronsfeld cipher is used with key "4321"?

Select an option to see the answer and solution.

Which of the following can be the base case for the recursive implementation used to find the length of a string?
#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.

Consider the given page reference string 2, 6, 1, 2, 0, 1, 5, 3. What will be the page fault rate, if the program has 3-page frames available to it and it uses the not recently used algorithm?

Select an option to see the answer and solution.

Not more than 2 queens can occur in an n-queens problem.

Select an option to see the answer and solution.

. . . . . . . . is a partition of the vertices of a graph in two disjoint subsets that are joined by atleast one edge.

Select an option to see the answer and solution.

It is possible to have a negative chromatic number of bipartite graph.

Select an option to see the answer and solution.

What is the domination number of the graph given below?
Miscellaneous on Data Structures mcq question image

Select an option to see the answer and solution.

Which of the following statement is true about stack?

Select an option to see the answer and solution.

What is the output of the following code?
#include<stdio.h>
#include<stdlib.h>
struct Node
{
     int val;
     struct Node* next;
}*head;
int linear_search(struct Node *temp,int value)
{
      if(temp == 0)
         return 0;
      if(temp->val == value)
         return 1;
      return linear_search(temp->next, value);
}
int main()
{
     int arr[6] = {1,2,3,4,5,6};
     int n = 6,i;
     head = (struct Node*)malloc(sizeof(struct Node));
     head->next = 0;
     struct Node *temp;
     temp = head;
     for(i=0; i<n; i++)
     {
           struct Node *newNode = (struct Node*)malloc(sizeof(struct Node));
           newNode->next = 0;
           newNode->val = arr[i];
           temp->next = newNode;
           temp = temp->next;
     }
     int ans = linear_search(head->next,6);
     if(ans == 1)
       printf("Found");
     else
       printf("Not found");
     return 0;
}

Select an option to see the answer and solution.

Who is the creator of Modern International Morse Code?

Select an option to see the answer and solution.

What is the multiplicity for the adjacency matrix of complete bipartite graph for 0 Eigen value?

Select an option to see the answer and solution.

What is the output of the following code?
int fibo(int n)
{
      if(n == 1)
        return 0;
      else if(n == 2)
        return 1;
      return fibo(n - 1) + fibo(n - 2);
}
int main()
{
     int n = 5;
     int ans = fibo(n);
     printf("%d",ans);
     return 0;
}

Select an option to see the answer and solution.

Maximum matching is also called as maximum cardinality matching.

Select an option to see the answer and solution.

What will be the output for the following code?
#include<stdio.h> 
void combination(int arr[],int n,int r,int index,int aux[],int i); 
void print(int arr[], int n, int r) 
{ 	
	int aux[r]; 
	combination(arr, n, r, 0, aux, 0); 
} 
void combination(int arr[], int n, int r, int index, int aux[], int i) 
{ 	
	if (index == r) 
	{ 
		for (int j=0; j<r; j++) 
			printf("%d ",aux[j]); 
		printf(", "); 
		return; 
	} 
	if (i >= n) 
		return; 
	aux[index] = arr[i]; 
	combination(arr, n, r, index+1, aux, i+1); 
	combination(arr, n, r, index, aux, i+1); 
} 
int main() 
{ 
	int arr[] = {1, 2,2}; 
	int r = 2; 
	int n = sizeof(arr)/sizeof(arr[0]); 
	print(arr, n, r); 
	return 0; 
}

Select an option to see the answer and solution.

What does the following code do?
#include<stdio.h>
#include<stdlib.h>
struct Node
{
     int val;
     struct Node* next;
}*head;
int linear_search(int value)
{
      struct Node *temp = head->next;
      while(temp != 0)
      {
           if(temp->val == value)
              return 1;
           temp = temp->next;
      }
      return 0;
}
int main()
{
      int arr[5] = {1,2,3,4,5};
      int n = 5,i;
      head = (struct Node*)malloc(sizeof(struct Node));
      head->next = 0;
      struct Node *temp;
      temp = head;
      for(i=0; i<n; i++)
      {
           struct Node *newNode = (struct Node*)malloc(sizeof(struct Node));
           newNode->next = 0;
           newNode->val = arr[i];
           temp->next = newNode;
           temp = temp->next;
      }
      int ans = linear_search(60);
      if(ans == 1)
      printf("Found");
      else
      printf("Not found");
      return 0;
}

Select an option to see the answer and solution.

Trithemius cipher is harder to crack than caesar cipher.

Select an option to see the answer and solution.

Which of the following takes O(n) time in worst case in array implementation of stack?

Select an option to see the answer and solution.

Every Perfect graph has forbidden graph characterization.

Select an option to see the answer and solution.

The problem of finding a subset of positive integers whose sum is equal to a given positive integer is called as?

Select an option to see the answer and solution.