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

30/59

Page

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

Route cipher is an example of . . . . . . . .

Select an option to see the answer and solution.

What will be the output for following code?
float power(float x, int y) 
{ 
	float temp; 
	if( y==0) 
	return 1; 
	temp = power(x, y/2);	 
	if (y%2 == 0) 
		return temp*temp; 
	else
	{ 
		if(y > 0) 
			return x*temp*temp; 
		else
			return (temp*temp)/x; 
	} 
} 
int main() 
{ 
	float x = 2; 
	int y = -3; 
	printf("%f", power(x, y)); 
	return 0; 
}

Select an option to see the answer and solution.

What will happen when the below code snippet is executed?
void my_recursive_function()
{
   my_recursive_function();
}
int main()
{
   my_recursive_function();
   return 0;
}

Select an option to see the answer and solution.

Which of the following was the first poly graphic cipher to be able to operate on more than 3 letters at once?

Select an option to see the answer and solution.

The Euler's totient function of a prime number will be (p - 1), where p is a prime number.

Select an option to see the answer and solution.

Suppose you have coins of denominations 1, 3 and 4. You use a greedy algorithm, in which you choose the largest denomination coin which is not greater than the remaining sum. For which of the following sums, will the algorithm produce an optimal answer?

Select an option to see the answer and solution.

What is the default value of seed if function rand() is called before srand()?

Select an option to see the answer and solution.

Which of the following option is wrong?

Select an option to see the answer and solution.

The time complexity of the following recursive implementation to find the factorial of a number is . . . . . . . .
int fact(int n)
{
     if(_________)
        return 1;
     return n * fact(n - 1);
}
int main()
{
      int n = 5;
      int ans = fact(n);
      printf("%d",ans);
      return 0;
}

Select an option to see the answer and solution.

Which graph is used to define the claw free graph?

Select an option to see the answer and solution.

What is the output of the following code?
#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);
}
int main()
{
     int n = 111,i;
     recursive_dec_to_bin(n);
     for(i=len-1; i>=0; i--)
     printf("%d",arr[i]);
     return 0;
}

Select an option to see the answer and solution.

Consider the following recursive implementation to find the nth fibonacci number:
int fibo(int n)
{
     if(n == 1)
        return 0;
     else if(n == 2)
        return 1;
     return ________;
}
int main()
{
     int n = 5;
     int ans = fibo(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.

The concept of cross product is applied in the field of computer graphics.

Select an option to see the answer and solution.

Which one of the following is the chromatic number of bipartite graph?

Select an option to see the answer and solution.

Backtracking algorithm is implemented by constructing a tree of choices called as?

Select an option to see the answer and solution.

Which of the following is not another name for GCD(Greatest Common Divisor)?

Select an option to see the answer and solution.

What is the time complexity of the above recursive implementation used to reverse a string?

Select an option to see the answer and solution.

Autokey cipher is an example of . . . . . . . .

Select an option to see the answer and solution.

Coalesced hashing is better than separate chaining.

Select an option to see the answer and solution.

In a complete bipartite graph Km, n, the minimum vertex cover is of the size max{m, n}.

Select an option to see the answer and solution.