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

49/59

Page

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

What is co-ordinate compression?

Select an option to see the answer and solution.

What is the time complexity of the following recursive implementation of linear search?
#include<stdio.h>
int recursive_search_num(int *arr, int num, int idx, int len)
{
     if(idx == len)
     return -1;
     if(arr[idx] == num)
     return idx;
     return recursive_search_num(arr, num, idx+1, len);
}
int main()
{
      int arr[8] ={1,2,3,3,3,5,6,7},num=5,len = 8;
      int indx = recursive_search_num(arr,num,0,len);
      printf("Index of %d is %d",num,indx);
      return 0;
}

Select an option to see the answer and solution.

What is the result of the recurrences which fall under third case of Master's theorem (let the recurrence be given by T(n)=aT(n/b)+f(n) and f(n)=nc?

Select an option to see the answer and solution.

What is the time complexity of the following recursive implementation used to find the sum of the first n natural numbers?
#include<stdio.h>
int recursive_sum(int n)
{
      if(n == 0)
        return 0;
      return n + recursive_sum(n - 1);
}
int main()
{
     int n = 5;
     int ans = recursive_sum(n);
     printf("%d",ans);
     return 0;
}

Select an option to see the answer and solution.

Which among the following is the worst case time complexity for deleting an element in coalesced hashing?

Select an option to see the answer and solution.

Minimum number of unique colors required for vertex coloring of a graph is called?

Select an option to see the answer and solution.

Consider the following iterative implementation to find the sum of digits of a number:
#include<stdio.h>
int sum_of_digits(int n)
{
      int sm = 0;
      while(n != 0)
      {
          _________;
          n /= 10;
      }
      return sm;
}
int main()
{
      int n = 1234;
      int ans = sum_of_digits(n);
      printf("%d",ans);
      return 0;
}
Which of the following lines should be inserted to complete the above code?

Select an option to see the answer and solution.

In the random page replacement algorithm, if the current page doesn't exist in the frame then it is replaced with which of the following page?

Select an option to see the answer and solution.

When a free man proposes to an available woman, which of the following happens?

Select an option to see the answer and solution.

Consider the following iterative implementation to find the length of the string:
#include<stdio.h>
int get_len(char *s)
{
      int len = 0;
      while(________)
        len++;
      return len;
}
int main()
{
      char *s = "harsh";
      int len = get_len(s);
      printf("%d",len);
      return 0;
}
Which of the following lines should be inserted to complete the above code?

Select an option to see the answer and solution.

Trifid cipher encrypts the plain text by using bifid cipher twice.

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 min_of_two(int a, int b)
{
      if(a < b)
        return a;
      return b;
}
int recursive_get_min(struct Node* temp)
{
      if(temp->next == 0)
        return  temp->val;
      return min_of_two(temp->val,recursive_get_min(temp->next));
}
int main()
{
     int n = 5, arr[5] ={1,1,1,1,1},i;
     struct Node *temp, *newNode;
     head = (struct Node*)malloc(sizeof(struct Node));
     head -> next =0;
     temp = head;
     for(i=0;i<n;i++)
     {
           newNode =(struct Node*)malloc(sizeof(struct Node));
           newNode->next = 0;
           newNode->val = arr[i];
           temp->next =newNode;
           temp = temp->next;
     }
     int min_num = recursive_get_min(head->next);
     printf("%d",min_num);
     return 0;
}

Select an option to see the answer and solution.

What will be the plain text corresponding to cipher text "BPKYFS" if playfair cipher is used with keyword as "SECRET" (assuming j is combined with i)?

Select an option to see the answer and solution.

What is the time complexity of the program to reverse stack when linked list is used for its implementation?

Select an option to see the answer and solution.

How many recursive calls are there in Recursive matrix multiplication through Simple Divide and Conquer Method?

Select an option to see the answer and solution.

The graph which contains eulerian tour, is called an euler graph.

Select an option to see the answer and solution.

What is the worst case time complexity of dynamic programming solution of the subset sum problem(sum=given subset sum)?

Select an option to see the answer and solution.

Pigpen cipher is not susceptible to frequency analysis.

Select an option to see the answer and solution.

Trithemius cipher is a special case of . . . . . . . .

Select an option to see the answer and solution.

Which of the following hashing technique is a combination of both separate chaining and open addressing techniques?

Select an option to see the answer and solution.