Q581
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
30/59
Page
Pick an option on a question to see the right answer and solution.
Q581
Open questionSelect an option to see the answer and solution.
Q582
Open questionfloat power(float x, int y)
{
float temp;
if( y==0)
return 1;
temp = power(x, y/2);
if (y%2 == 0)
return temp*temp;
else
{
if(y > 0)
return x*temp*temp;
else
return (temp*temp)/x;
}
}
int main()
{
float x = 2;
int y = -3;
printf("%f", power(x, y));
return 0;
}Select an option to see the answer and solution.
Q583
Open questionvoid my_recursive_function()
{
my_recursive_function();
}
int main()
{
my_recursive_function();
return 0;
}Select an option to see the answer and solution.
Q584
Open questionSelect an option to see the answer and solution.
Q585
Open questionSelect an option to see the answer and solution.
Q586
Open questionSelect an option to see the answer and solution.
Q587
Open questionSelect an option to see the answer and solution.
Q588
Open questionSelect an option to see the answer and solution.
Q589
Open questionint fact(int n)
{
if(_________)
return 1;
return n * fact(n - 1);
}
int main()
{
int n = 5;
int ans = fact(n);
printf("%d",ans);
return 0;
}Select an option to see the answer and solution.
Q590
Open questionSelect an option to see the answer and solution.
Q591
Open question#include<stdio.h>
int arr[31], len = 0;
void recursive_dec_to_bin(int n)
{
if(n == 0 && len == 0)
{
arr[len++] = 0;
return;
}
if(n == 0)
return;
arr[len++] = n % 2;
recursive_dec_to_bin(n/2);
}
int main()
{
int n = 111,i;
recursive_dec_to_bin(n);
for(i=len-1; i>=0; i--)
printf("%d",arr[i]);
return 0;
}Select an option to see the answer and solution.
Q592
Open questionint fibo(int n)
{
if(n == 1)
return 0;
else if(n == 2)
return 1;
return ________;
}
int main()
{
int n = 5;
int ans = fibo(n);
printf("%d",ans);
return 0;
}
Which of the following lines should be inserted to complete the above code?Select an option to see the answer and solution.
Q593
Open questionSelect an option to see the answer and solution.
Q594
Open questionSelect an option to see the answer and solution.
Q595
Open questionSelect an option to see the answer and solution.
Q596
Open questionSelect an option to see the answer and solution.
Q597
Open questionSelect an option to see the answer and solution.
Q598
Open questionSelect an option to see the answer and solution.
Q599
Open questionSelect an option to see the answer and solution.
Q600
Open questionSelect an option to see the answer and solution.