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

34/59

Page

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

What will be the output of the following code?
#include <stdio.h> 
#include <string.h> 
#include <iostream.h>
using namespace std;
void swap(char *x, char *y) 
{ 
	char temp; 
	temp = *x; 
	*x = *y; 
	*y = temp; 
} 
 
void func(char *a, int l, int r) 
{ 
int i; 
if (l == r) 
	cout<<a<<” ,”; 
else
{ 
	for (i = l; i <= r; i++) 
	{ 
		swap((a+l), (a+i)); 
		func(a, l+1, r); 
		swap((a+l), (a+i)); 
	} 
} 
} 
 
int main() 
{ 
	char str[] = "AA"; 
	int n = strlen(str); 
	func(str, 0, n-1); 
	return 0; 
}

Select an option to see the answer and solution.

How many solutions are there for 8 queens on 8*8 board?

Select an option to see the answer and solution.

How many times is the function recursive_sum_of_digits() called when the following code is executed?
#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 = 1201;
      int ans = recursive_sum_of_digits(n);
      printf("%d",ans);
      return 0;
}

Select an option to see the answer and solution.

The problem of finding a list of integers in a given specific range that meets certain conditions is called?

Select an option to see the answer and solution.

A vertex in a graph, on the removal of whose increases the number of connected components is called?

Select an option to see the answer and solution.

Which of the following is also known as GCD?

Select an option to see the answer and solution.

The most important condition for which closest pair is calculated for the points (pi, pj) is?

Select an option to see the answer and solution.

What will be the time complexity of the following code?
int xpowy(int x, int n)
{
    if (n==0) 
        return 1;
    if (n==1) 
        return x;
    if ((n % 2) == 0)
        return xpowy(x*x, n/2);
    else
        return xpowy(x*x, n/2) * x;
}

Select an option to see the answer and solution.

Encryption in Autokey cipher is done using . . . . . . . .

Select an option to see the answer and solution.

Cross product is a mathematical operation performed between . . . . . . . .

Select an option to see the answer and solution.

What is the time complexity of the following recursive implementation used to find the length of the string?
#include<stdio.h>
int recursive_get_len(char *s, int len)
{
      if(s[len] == 0)
        return 0;
      return 1 + recursive_get_len(s, len+1);
}
int main()
{
      char *s = "abcdef";
      int len = recursive_get_len(s,0);
      printf("%d",len);
      return 0;
}

Select an option to see the answer and solution.

Strassen's algorithm is a/an. . . . . . . . algorithm.

Select an option to see the answer and solution.

Consider the following recursive implementation to find the factorial of a number. Which of the lines should be inserted to complete the below code?
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.

What is the time complexity of the following code used to search an element in an array?
#include<stdio.h>
int search_num(int *arr, int num, int len)
{
     int i;
     for(i = 0; i < len; i++)
     if(arr[i] == num)
        return i;
     return -1;
}
int main()
{
      int arr[5] ={1,3,3,3,5},num=3,len = 5;
      int indx = search_num(arr,num,len);
      printf("Index of %d is %d",num,indx);
      return 0;
}

Select an option to see the answer and solution.

In which year the symbol @ was added to the official Morse character set by ITU-R?

Select an option to see the answer and solution.

What will be the chromatic index of the following graph?
Miscellaneous on Data Structures mcq question image

Select an option to see the answer and solution.

What is the auxiliary space requirement of the quickselect algorithm?

Select an option to see the answer and solution.

Are trees bipartite?

Select an option to see the answer and solution.

Bellmann Ford Algorithm is an example for . . . . . . . .

Select an option to see the answer and solution.

By using which of the following data structure, the hash sequence is implemented within the hash table in coalesced hashing?

Select an option to see the answer and solution.