ExamVeda
Login
Home
61
Which of the following is the biggest advantage of selection sort?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
62
Minimum cut algorithm comes along with the maximum flow problem.
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
63
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?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
64
Flooding algorithm requires all the network information before implementation.
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
65
Who formulated the first ever algorithm for solving the Hamiltonian path problem?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
66
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)
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
67
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; 
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
68
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?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
69
Most Efficient Time Complexity of Topological Sorting is? (V - number of vertices, E - number of edges)
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
70
What is the total number of iterations used in a maximum- matching algorithm?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board