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

24/59

Page

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

Which of the following is not a type of poly alphabetic cipher?

Select an option to see the answer and solution.

How many times is the function recursive_sum() called when the following code is executed?
#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.

How many times is the function recursive_reverse_string() called when the following code is executed?
#include<stdio.h>
#include<string.h>
void recursive_reverse_string(char *s, int left, int right)
{
     if(left < right)
     {
         char tmp = s[left];
         s[left] = s[right];
         s[right] = tmp;
         recursive_reverse_string(s, left+1, right-1);
     }
}
int main()
{
     char s[100] = "madam";
     int len = strlen(s);
     recursive_reverse_string(s,0,len-1);
     printf("%s",s);
     return 0;
}

Select an option to see the answer and solution.

Which of the following is a difference between trithemius cipher and vigenere cipher?

Select an option to see the answer and solution.

What is the number of swaps required to sort the array arr={5, 3, 2, 4, 1} using recursive selection sort?

Select an option to see the answer and solution.

Consider the following number of activities with their start and finish time given below. Which of following activity will be left out?
Activity Starting time Finish time
A1 1 2
A2 3 5
A3 4 6
A4 5 8

Select an option to see the answer and solution.

What is the maximal independent set for the graph given below?
Miscellaneous on Data Structures mcq question image

Select an option to see the answer and solution.

Affine cipher is not susceptible to frequency analysis.

Select an option to see the answer and solution.

. . . . . . . . has the lowest fault rate of all the page replacement algorithms.

Select an option to see the answer and solution.

What is the base case for the following code?
void my_recursive_function(int n)
{
     if(n == 0)
     return;
     printf("%d ",n);
     my_recursive_function(n-1);
}
int main()
{
     my_recursive_function(10);
     return 0;
}

Select an option to see the answer and solution.

What is the output of the following code?
#include<stdio.h>
#include<string.h>
void reverse_string(char *s)
{
     int len = strlen(s);
     int i,j;
     i=0;
     j=len-1;
     while(i < j)
     {
         char tmp = s[i];
         s[i] = s[j];
         s[j] = tmp;
         i++;
         j--;
     }
}
int main()
{
      char s[100] = "rotator";
      char t[100];
      strcpy(t,s);
      reverse_string(s);
      if(strcmp(t,s) == 0)
        printf("Yes");
      else
        printf("No");
      return 0;
}

Select an option to see the answer and solution.

What is the chromatic number of compliment of line graph of bipartite graph?

Select an option to see the answer and solution.

Which of the following is an NP complete problem?

Select an option to see the answer and solution.

Which of the following is the correct mathematical application of Euclid's algorithm?

Select an option to see the answer and solution.

What will be the time complexity of the brute force approach used to find the articulation points in a given graph?
For every vertex V, do: 
Remove V from the graph  
See if the graph remains connected 
If graph is disconnected, add V to the resultant set  
Add V back to the graph

Select an option to see the answer and solution.

What is the running time of the Huffman algorithm, if its implementation of the priority queue is done using linked lists?

Select an option to see the answer and solution.

Running key cipher is harder to decipher than keyword cipher.

Select an option to see the answer and solution.

Including a parity bit along with the data surely detects the errors.

Select an option to see the answer and solution.

What is the time complexity of the recursive implementation used to convert a decimal number to its binary equivalent?
#include<stdio.h>
int arr[31], len = 0;
void recursive_dec_to_bin(int n)
{
      if(n == 0 && len == 0)
      {
          arr[len++] = 0;
          return;
      }
      if(n == 0)
         return;
      arr[len++] = n % 2;
      recursive_dec_to_bin(n/2);
}

Select an option to see the answer and solution.

What is the time complexity for finding a Hamiltonian path for a graph having N vertices (using permutation)?

Select an option to see the answer and solution.