Q321
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
17/59
Page
Pick an option on a question to see the right answer and solution.
Q321
Open questionSelect an option to see the answer and solution.
Q322
Open questionSelect an option to see the answer and solution.
Q323
Open question#include<stdio.h>
int recursive_get_len(char *s, int len)
{
if(s[len] == 0)
return 0;
return 1 + recursive_get_len(s, len+1);
}
int main()
{
char *s = "123-1-2-3";
int len = recursive_get_len(s,0);
printf("%d",len);
return 0;
}Select an option to see the answer and solution.
Q324
Open questionSelect an option to see the answer and solution.
Q325
Open questionSelect an option to see the answer and solution.
Q326
Open questionSelect an option to see the answer and solution.
Q327
Open questionSelect an option to see the answer and solution.
Q328
Open questionSelect an option to see the answer and solution.
Q329
Open question#include<stdio.h>
#include<string.h>
void reverse_string(char *s)
{
int len = strlen(s);
int i,j;
i=0;
j=len-1;
while(i < j)
{
char tmp = s[i];
s[i] = s[j];
s[j] = tmp;
i++;
j--;
}
}
int main()
{
char s[100] = "reverse";
reverse_string(s);
printf("%s",s);
return 0;
}Select an option to see the answer and solution.
Q330
Open questionSelect an option to see the answer and solution.
Q331
Open question#include<stdio.h>
int power(int x, int y)
{
int temp;
if( y == 0)
return 1;
temp = power(x, y/2);
if (y%2 == 0)
return temp*temp;
else
return x*temp*temp;
}
int main()
{
int x = 2;
int y = 3;
printf("%d", power(x, y));
return 0;
}Select an option to see the answer and solution.
Q332
Open questionSelect an option to see the answer and solution.
Q333
Open questionint fibo(int n)
{
if(n == 1)
return 0;
else if(n == 2)
return 1;
return fibo(n - 1) + fibo(n - 2);
}
int main()
{
int n = -1;
int ans = fibo(n);
printf("%d",ans);
return 0;
}Select an option to see the answer and solution.
Q334
Open questionSelect an option to see the answer and solution.
Q335
Open question#include <bits/stdc++.h>
using namespace std;
void convert(int a[], int n)
{
vector <pair<int, int> > vec;
for (int i = 0; i < n; i++)
vec.push_back(make_pair(a[i], i));
sort(vec.begin(), vec.end());
for (int i=0; i<n; i++)
a[vec[i].second] = i;
}
void printArr(int a[], int n)
{
for (int i=0; i<n; i++)
cout << a[i] << " ";
}
int main()
{
int arr[] = {10,8,2,5,7};
int n = sizeof(arr)/sizeof(arr[0]);
convert(arr , n);
printArr(arr, n);
return 0;
}Select an option to see the answer and solution.
Q336
Open questionSelect an option to see the answer and solution.
Q337
Open questionSelect an option to see the answer and solution.
Q338
Open questionSelect an option to see the answer and solution.
Q339
Open questionSelect an option to see the answer and solution.
Q340
Open questionSelect an option to see the answer and solution.