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

47/59

Page

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

What is the rate of hamming codes?

Select an option to see the answer and solution.

Which of the following is an application of the graph coloring problem?

Select an option to see the answer and solution.

Which of the following ciphered text would have used transposition cipher for encryption of the plain text "DATASTRUCTURE"?

Select an option to see the answer and solution.

Which of the following best represents the time complexity of Karger's algorithm?

Select an option to see the answer and solution.

In the not recently used algorithm, which page is to be replaced when the new page comes in?

Select an option to see the answer and solution.

What is the space complexity of the following recursive implementation to find the factorial of a number?
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.

Number of elements in the power set of set S={1, 2, 2} will be?

Select an option to see the answer and solution.

. . . . . . . . algorithm associates with each page the time when the page was brought into memory.

Select an option to see the answer and solution.

What is the output of the following code?
#include<stdio.h>
int recursive_search_num(int *arr, int num, int idx, int len)
{
     if(idx == len)
     return -1;
     if(arr[idx] == num)
       return idx;
     return recursive_search_num(arr, num, idx+1, len);
}
int main()
{
      int arr[8] ={1,2,3,3,3,5,6,7},num=5,len = 8;
      int indx = recursive_search_num(arr,num,0,len);
      printf("Index of %d is %d",num,indx);
      return 0;
}

Select an option to see the answer and solution.

Which of the following is are two types of traditional cipher?

Select an option to see the answer and solution.

Floyd's cycle detection algorithm is a pointer algorithm.

Select an option to see the answer and solution.

What is meant by the single dot in Morse code?

Select an option to see the answer and solution.

How many columns do we need to have in the table, that is used for encryption in columnar transposition cipher when a given keyword is "SECRET" and plain text is "DATASTRUCTURE"?

Select an option to see the answer and solution.

Which symbol is not defined inside the ITU recommendation on Morse code?

Select an option to see the answer and solution.

Is the letter "E" represented by the single dot in Morse code?

Select an option to see the answer and solution.

What will be the time complexity of 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.

In which of the below cases will the following code produce a wrong output?
int recursive_binary_search(int *arr, int num, int lo, int hi)
{
      if(lo > hi)
       return -1;
      int mid = (lo + hi)/2;
      if(arr[mid] == num)
       return mid;
      else if(arr[mid] < num)
          lo = mid + 1;
      else
          hi = mid - 1;
      return recursive_binary_search(arr, num, lo, hi);
}

Select an option to see the answer and solution.

Which of the following gives the sum of the first n natural numbers?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Which of the following cipher is created by shuffling the letters of a word?

Select an option to see the answer and solution.