Q261
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
14/59
Page
Pick an option on a question to see the right answer and solution.
Q261
Open questionSelect an option to see the answer and solution.
Q262
Open questionSelect an option to see the answer and solution.
Q263
Open questionSelect an option to see the answer and solution.
Q264
Open questionSelect an option to see the answer and solution.
Q265
Open questionSelect an option to see the answer and solution.
Q266
Open questionSelect an option to see the answer and solution.
Q267
Open question#include<stdio.h>
int get_sum(int n)
{
int sm, i;
for(i = 1; i <= n; i++)
sm += i;
return sm;
}
int main()
{
int n = 10;
int ans = get_sum(n);
printf("%d",ans);
return 0;
}Select an option to see the answer and solution.
Q268
Open questionSelect an option to see the answer and solution.
Q269
Open questionSelect an option to see the answer and solution.
Q270
Open questionSelect an option to see the answer and solution.
Q271
Open questionSelect an option to see the answer and solution.
Q272
Open questionstruct Node
{
int val;
struct Node* next;
}*head;
int max_of_two(int a, int b)
{
if(a > b)
return a;
return b;
}
int recursive_get_max(struct Node* temp)
{
if(temp->next == 0)
return temp->val;
return max_of_two(______, _______);
}
Which of the following arguments should be passed to the function max_of two() to complete the above code?Select an option to see the answer and solution.
Q273
Open questionSelect an option to see the answer and solution.
Q274
Open questionSelect an option to see the answer and solution.
Q275
Open questionSelect an option to see the answer and solution.
Q276
Open questionSelect an option to see the answer and solution.
Q277
Open question#include <stdio.h>
bool func (int arr[], int n)
{
int sum = 0;
int i, j;
for (i = 0; i < n; i++)
sum += arr[i];
if (sum%2 != 0)
return false;
bool partition[sum/2+1][n+1];
for (i = 0; i <= n; i++)
partition[0][i] = true;
for (i = 1; i <= sum/2; i++)
partition[i][0] = false;
for (i = 1; i <= sum/2; i++)
{
for (j = 1; j <= n; j++)
{
partition[i][j] = partition[i][j-1];
if (i >= arr[j-1])
partition[i][j] = partition[i][j] || partition[i - arr[j-1]][j-1];
}
}
return partition[sum/2][n];
}
int main()
{
int arr[] = {3, 3, 4, 4, 7};
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.
Q278
Open questionSelect an option to see the answer and solution.
Q279
Open question
Select an option to see the answer and solution.
Q280
Open questionSelect an option to see the answer and solution.