ExamVeda
Login
Home
61
What is the time complexity of the following code?
#include <bits/stdc++.h> 
using namespace std; 
void convert(int arr[], int n) 
{ 	
	int temp[n]; 
	memcpy(temp, arr, n*sizeof(int)); 
	sort(temp, temp + n); 	
        unordered_map<int, int> map; 	
	int sort_index = 0; 
	for (int i = 0; i < n; i++) 
		map[temp[i]] = sort_index++; 	
	for (int i = 0; i < n; i++) 
		arr[i] = map[arr[i]]; 
} 
void printArr(int arr[], int n) 
{ 
	for (int i=0; i<n; i++) 
		cout << arr[i] << " "; 
} 
int main() 
{ 
	int arr[] = {10, 20, 15, 12, 11, 50}; 
	int n = sizeof(arr)/sizeof(arr[0]); 
	convert(arr , n); 	
	printArr(arr, n); 
	return 0; 
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
62
What is meant by the power set of a set?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
63
Which of the following is considered as the top of the stack in the linked list implementation of the stack?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
64
Which of the following is an application of the minimum cut problem?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
65
What is the following expression, lcm (a, lcm (b, c) equal to?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
66
A key matrix used for encryption in hill cipher must be?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
67
What is the output of the following code?
#include<stdio.h>
int search_num(int *arr, int num, int len)
{
     int i;
     for(i = 0; i < len; i++)
     if(arr[i] == num)
        return i;
     return -1;
}
int main()
{
      int arr[5] ={1,3,3,3,5},num=3,len = 5;
      int indx = search_num(arr,num,len);
      printf("Index of %d is %d",num,indx);
      return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
68
Gronsfeld cipher is similar to?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
69
Atbash cipher cannot be cracked until the exact type of encryption of ciphered text is known.
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
70
Which of the following methods can be used to find the largest and smallest number in a linked list?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board