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

29/59

Page

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

Which of the following is the biggest advantage of selection sort?

Select an option to see the answer and solution.

Minimum cut algorithm comes along with the maximum flow problem.

Select an option to see the answer and solution.

Consider the following code snippet to find the largest element in a linked list:
struct Node{
   int val;
   struct Node *next;
}*head;
int get_max()
{
      struct Node* temp = head->next;
	  int max_num = temp->val;
	  while(______)
	  {
	        if(temp->val > max_num)
		    max_num = temp->val;
		temp = temp->next;
	  }
	  return max_num;
}
Which of the following lines should be inserted to complete the above code?

Select an option to see the answer and solution.

Flooding algorithm requires all the network information before implementation.

Select an option to see the answer and solution.

Who formulated the first ever algorithm for solving the Hamiltonian path problem?

Select an option to see the answer and solution.

What is the output of the following code in python, if the input is given as 8?
def CatalanNumber(n): 
    if n<= 1 : 
        return 1 
    result=0
    for x in range(n): 
        result = result + CatalanNumber(x) * CatalanNumber(n-x-1) 
    return result
n=int(input("Enter the number:"))
answer=CatalanNumber(n)
print(" ", answer)

Select an option to see the answer and solution.

What will be the output for the given code?
#include <stdio.h> 
#include <stdbool.h> 
bool func1(int arr[], int n, int sum) 
{ 
    if (sum == 0) 
	return true; 
    if (n == 0 && sum != 0) 
	return false; 
    if (arr[n-1] > sum) 
	return func1(arr, n-1, sum); 
    return func1(arr, n-1, sum) || func1(arr, n-1, sum-arr[n-1]); 
} 
bool func (int arr[], int n) 
{ 	
	int sum = 0; 
	for (int i = 0; i < n; i++) 
	sum += arr[i]; 	
	if (sum%2 != 0) 
	return false; 
	return func1 (arr, n, sum/2); 
} 
int main() 
{ 
    int arr[] = {4,6, 12, 2}; 
    int n = sizeof(arr)/sizeof(arr[0]); 
    if (func(arr, n) == true) 
	printf("true"); 
    else
	printf("false"); 
    return 0; 
}

Select an option to see the answer and solution.

Consider the following recursive implementation used to reverse a string:
void recursive_reverse_string(char *s, int left, int right)
{
     if(left < right)
     {
         char tmp = s[left];
         s[left] = s[right];
         s[right] = tmp;
         _________;
     }
}
Which of the following lines should be inserted to complete the above code?

Select an option to see the answer and solution.

Most Efficient Time Complexity of Topological Sorting is? (V - number of vertices, E - number of edges)

Select an option to see the answer and solution.

What is the total number of iterations used in a maximum- matching algorithm?

Select an option to see the answer and solution.

What is the minimum cut of the following network?
Miscellaneous on Data Structures mcq question image

Select an option to see the answer and solution.

What will be the plain text corresponding to cipher text "SFNUFACT" if with number of columns are given to be 3 and route of reading is from the bottom right anti clockwise?

Select an option to see the answer and solution.

FIFO algorithm is used by . . . . . . . . operating system.

Select an option to see the answer and solution.

Which of the following statements is true?

Select an option to see the answer and solution.

What will be the auxiliary space requirement (excluding call stack) of the program to print combinations of r elements each from array of size n?

Select an option to see the answer and solution.

How many keys are required for encryption and decryption of data when we use asymmetric cipher?

Select an option to see the answer and solution.

Which of the following methods can be used to find the sum of digits of a number?

Select an option to see the answer and solution.

Euler's totient function is multiplicative.

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Which of the following is the simplest page replacement algorithm?

Select an option to see the answer and solution.