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

17/59

Page

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

The main time taking step in fractional knapsack problem is . . . . . . . .

Select an option to see the answer and solution.

Solve the following recurrence using Master's theorem.
T(n) = T (n/2) + 2n

Select an option to see the answer and solution.

What is the output of the following code?
#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 = "123-1-2-3";
      int len = recursive_get_len(s,0);
      printf("%d",len);
      return 0;
}

Select an option to see the answer and solution.

A connected graph has a maximum of (n - 2) cut vertices.

Select an option to see the answer and solution.

Which of the following will generate random numbers in the range 1-100 (both inclusive)?

Select an option to see the answer and solution.

What will be the ciphered text corresponding to "EXAMPLE" if trithemius cipher is used for encryption?

Select an option to see the answer and solution.

Euclidean algorithm does not require the calculation of prime factors.

Select an option to see the answer and solution.

A graph with chromatic number less than or equal to k is called?

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] = "reverse";
      reverse_string(s);
      printf("%s",s);
      return 0;
}

Select an option to see the answer and solution.

Which page replacement strategy uses referenced bits and modified bits to replace the page?

Select an option to see the answer and solution.

What will be the time complexity of the following code?
#include<stdio.h> 
int power(int x, int y) 
{ 
    int temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2); 
    if (y%2 == 0) 
        return temp*temp; 
    else
        return x*temp*temp; 
} 
int main() 
{ 
	int x = 2; 
    int y = 3; 
 
	printf("%d", power(x, y)); 
	return 0; 
}

Select an option to see the answer and solution.

In terms of Venn Diagram, which of the following expression gives GCD (Given A ꓵ B ≠ Ø)?

Select an option to see the answer and solution.

What is the output of the following code?
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 = -1;
     int ans = fibo(n);
     printf("%d",ans);
     return 0;
}

Select an option to see the answer and solution.

The dash duration is how many times the dot duration?

Select an option to see the answer and solution.

What is the auxiliary space complexity of the given code?
#include <bits/stdc++.h> 
using namespace std;  
void convert(int a[], int n) 
{ 	
	vector <pair<int, int> > vec; 	
	for (int i = 0; i < n; i++) 
		vec.push_back(make_pair(a[i], i)); 	
	sort(vec.begin(), vec.end()); 
	for (int i=0; i<n; i++) 
		a[vec[i].second] = i; 
} 
void printArr(int a[], int n) 
{ 
	for (int i=0; i<n; i++) 
		cout << a[i] << " "; 
} 
int main() 
{ 
	int arr[] = {10,8,2,5,7}; 
	int n = sizeof(arr)/sizeof(arr[0]);  
	convert(arr , n); 
   	printArr(arr, n); 
	return 0; 
}

Select an option to see the answer and solution.

The chromatic number of star graph with 3 vertices is greater than that of a tree with same number of vertices.

Select an option to see the answer and solution.

What is the time complexity of fleury's algorithm?

Select an option to see the answer and solution.

Which of the following cipher uses two keys to encrypt data?

Select an option to see the answer and solution.

What is the length of the dot in Morse code?

Select an option to see the answer and solution.

What will be the ciphered text corresponding to plain text "ACT" if pigpen cipher is used for encryption?

Select an option to see the answer and solution.