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

12/59

Page

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

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

Vigenere table consists of . . . . . . . .

Select an option to see the answer and solution.

What will be the lexicographical order of permutations formed from the array arr={1,2,3}?

Select an option to see the answer and solution.

What is the computational complexity of Binary GCD algorithm where a and b are integers?

Select an option to see the answer and solution.

Chan's algorithm is used for computing . . . . . . . .

Select an option to see the answer and solution.

Which of the following was the first diagram substitution cipher?

Select an option to see the answer and solution.

In a graph, perfect matching exists only if the number of vertices is even.

Select an option to see the answer and solution.

Which of the following is used as signal duration in Morse Code?

Select an option to see the answer and solution.

How many combinations of 2 elements will be formed from the array arr={1, 2, 3}?

Select an option to see the answer and solution.

Minimum number of moves required to solve a tower of hanoi problem with n disks is . . . . . . . .

Select an option to see the answer and solution.

Recursive solution of Set partition problem is faster than dynamic problem solution in terms of time complexity.

Select an option to see the answer and solution.

What is the output of the following code?
#include<stdio.h>
int recursive_sum_of_digits(int n)
{
      if(n == 0)
        return 0;
      return n % 10 + recursive_sum_of_digits(n/10);
}
int main()
{
      int n = 1234321;
      int ans = recursive_sum_of_digits(n);
      printf("%d",ans);
      return 0;
}

Select an option to see the answer and solution.

Consider the following iterative implementation to find the factorial of a number. Which of the lines should be inserted to complete the below code?
int main()
{
    int n = 6, i;
    int fact = 1;
    for(i=1;i<=n;i++)
      _________;
    printf("%d",fact);
    return 0;
}

Select an option to see the answer and solution.

What is the basic operation of closest pair algorithm using brute force technique?

Select an option to see the answer and solution.

Which of the following is not a type of transposition cipher?

Select an option to see the answer and solution.

The running time of implementing naive solution to min-cut problem is?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

What is the result of the recurrences which fall under first 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 will be the encrypted text corresponding to plain text "CLASSIFIED" using columnar transposition cipher with a keyword as "GAMES"?

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 aux[], int start, int end, int index, int r); 
void print(int arr[], int n, int r) 
{ 	
	int aux[r]; 
        combination(arr, aux, 0, n-1, 0, r); 
}
void combination(int arr[], int aux[], int start, int end, int index, int r) 
{ 	
	if (index == r) 
	{ 
		for (int j=0; j<r; j++) 
			printf("%d ", aux[j]); 
		printf(", "); 
		return; 
	} 	
	for (int i=start; i<=end && end-i+1 >= r-index; i++) 
	{   aux[index] = arr[i]; 
		combination(arr, aux, i+1, end, index+1, r); 
	} 
}  
int main() 
{ 
	int arr[] = {1, 2, 3}; 
	int r = 2; 
	int n = sizeof(arr)/sizeof(arr[0]); 
	print(arr, n, r); 
}

Select an option to see the answer and solution.