ExamVeda
Login
Home
61
What is the prime task of the stable marriage problem?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
62
What is the approach implemented in the following code?
#include<iostream> 
using namespace std;  
void printArray(int p[], int n) 
{ 
	for (int i = 0; i <= n-1; i++) 
	cout << p[i] << " "; 
	cout << endl; 
} 
void func1(int n) 
{ 
	int p[n];  
	int k = 0;  
	p[k] = n; 	
	while (true) 
	{ 		
		printArray(p, k+1); 		
		int rem_val = 0; 
		while (k >= 0 && p[k] == 1) 
		{ 
			rem_val += p[k]; 
			k--; 
		} 
		if (k < 0) return; 	
		p[k]--; 
		rem_val++; 		
		while (rem_val > p[k]) 
		{ 
			p[k+1] = p[k]; 
			rem_val = rem_val - p[k]; 
			k++; 
		} 
		p[k+1] = rem_val; 
		k++; 
	} 
} 
 
int main() 
{ 
      int n;
      cin>>n;
      func1(n);
      return 0; 
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
63
Which cipher is represented by the following function?
void Cipher(string msg, string key) 
{ 
	// Get key matrix from the key string 
	int keyMat[3][3]; 
	getKeyMatrix(key, keyMat); 
	int msgVector[3][1]; 	
	for (int i = 0; i <=2; i++) 
		msgVector[i][0] = (msg[i]) % 65; 
	int cipherMat[3][1]; 
	// Following function generates 
	// the encrypted vector 
	encrypt(cipherMat, keyMat, msgVector); 
	string CipherText; 	
	for (int i = 0; i <=2; i++) 
		CipherText += cipherMat[i][0] + 65; 	
	cout  << CipherText; 
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
64
Bifid square combines autokey square with transposition.
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
65
Given items as {value,weight} pairs {{40, 20},{30, 10},{20, 5}}. The capacity of knapsack=20. Find the maximum value output assuming items to be divisible.
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
66
A graph has 20 vertices. The maximum number of edges it can have is? (Given it is bipartite)
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
67
Which of the following best represents the time complexity for inserting an element in coalesced hashing?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
68
Which of the following is not an application of inclusion-exclusion principle?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
69
What is common between affine cipher and pigpen cipher.
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
70
What is the time complexity of the following iterative implementation used to find the largest and smallest element in an array?
#include<stdio.h>
int get_max_element(int *arr,int n)
{
      int i, max_element = arr[0];
      for(i = 1; i < n; i++)
        if(arr[i] > max_element)
          max_element = arr[i];
      return max_element;
}
int get_min_element(int *arr, int n)
{
      int i, min_element;
      for(i = 1; i < n; i++)
        if(arr[i] < min_element)
          min_element = arr[i];
      return min_element;
}
int main()
{
     int n = 7, arr[7] = {1,1,1,0,-1,-1,-1};
     int max_element = get_max_element(arr,n);
     int min_element = get_min_element(arr,n);
     printf("%d %d",max_element,min_element);
     return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board