Q181
Open questionSelect an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
1,171
Questions
10/59
Page
Pick an option on a question to see the right answer and solution.
Q181
Open questionSelect an option to see the answer and solution.
Q182
Open question#include <stdlib.h>
int main()
{
srand(0);
printf("%d\n", rand());
return 0;
}Select an option to see the answer and solution.
Q183
Open questionSelect an option to see the answer and solution.
Q184
Open questionSelect an option to see the answer and solution.
Q185
Open questionSelect an option to see the answer and solution.
Q186
Open questionSelect an option to see the answer and solution.
Q187
Open questionSelect an option to see the answer and solution.
Q188
Open questionSelect an option to see the answer and solution.
Q189
Open questionSelect an option to see the answer and solution.
Q190
Open question#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;
}Select an option to see the answer and solution.
Q191
Open questionSelect an option to see the answer and solution.
Q192
Open questionSelect an option to see the answer and solution.
Q193
Open questionSelect an option to see the answer and solution.
Q194
Open questionSelect an option to see the answer and solution.
Q195
Open questionSelect an option to see the answer and solution.
Q196
Open question#include<stdio.h>
void dec_to_bin(int n)
{
int arr[31],len = 0,i;
if(n == 0)
{
arr[0] = 0;
len = 1;
}
while(n != 0)
{
arr[len++] = n % 2;
n /= 2;
}
for(i=len-1; i>=0; i--)
printf("%d",arr[i]);
}
int main()
{
int n = 63;
dec_to_bin(n);
return 0;
}Select an option to see the answer and solution.
Q197
Open questionSelect an option to see the answer and solution.
Q198
Open questionSelect an option to see the answer and solution.
Q199
Open question#include<stdio.h>
#include<stdlib.h>
struct Node
{
int val;
struct Node *next;
}*head;
int get_len()
{
struct Node *temp = head->next;
int len = 0;
while(temp != 0)
{
len++;
temp = temp->next;
}
return len;
}
int main()
{
int arr[10] = {1,2,3,4,5}, n = 5, i;
struct Node *temp, *newNode;
head = (struct Node*)malloc(sizeof(struct Node));
head->next = 0;
temp = head;
for(i=0; i<n; i++)
{
newNode = (struct Node*)malloc(sizeof(struct Node));
newNode->val = arr[i];
newNode->next = 0;
temp->next = newNode;
temp = temp->next;
}
int len = get_len();
printf("%d",len);
return 0;
}Select an option to see the answer and solution.
Q200
Open questionSelect an option to see the answer and solution.