21. What will be the output for following code?
#include <stdio.h>
#include <string.h>
#include <iostream.h>
using namespace std;
void swap(char *x, char *y)
{
char temp;
temp = *x;
*x = *y;
*y = temp;
}
void func(char *a, int l, int r)
{
int i;
if (l == r)
cout<<a<<” ,”;
else
{
for (i = l; i <= r; i++)
{
swap((a+l), (a+i));
func(a, l+1, r);
swap((a+l), (a+i));
}
}
}
int main()
{
char str[] = "AB";
int n = strlen(str);
func(str, 0, n-1);
return 0;
}
#include <stdio.h>
#include <string.h>
#include <iostream.h>
using namespace std;
void swap(char *x, char *y)
{
char temp;
temp = *x;
*x = *y;
*y = temp;
}
void func(char *a, int l, int r)
{
int i;
if (l == r)
cout<<a<<” ,”;
else
{
for (i = l; i <= r; i++)
{
swap((a+l), (a+i));
func(a, l+1, r);
swap((a+l), (a+i));
}
}
}
int main()
{
char str[] = "AB";
int n = strlen(str);
func(str, 0, n-1);
return 0;
}
22. Route cipher falls under the category of?
23. What is the time complexity of floyd's cycle finding algorithm?
24. In general, which of the following methods isn't used to find the factorial of a number?
25. The choice of polynomial class has led to the development of an extensive theory called . . . . . . . .
26. What is the average case time complexity of recursive selection sort?
27. What is the output of the following code?
int 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 = 10;
int ans = fibo(n);
printf("%d",ans);
return 0;
}
int 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 = 10;
int ans = fibo(n);
printf("%d",ans);
return 0;
}
28. Fractional knapsack problem is solved most efficiently by which of the following algorithm?
29. As the number of frames available increases, the number of page faults decreases.
30. If 4 is the GCD of 16 and 12, What is the GCD of 12 and 4?
Read More Section(Miscellaneous on Data Structures)
Each Section contains maximum 100 MCQs question on Miscellaneous on Data Structures. To get more questions visit other sections.
- Miscellaneous on Data Structures - Section 1
- Miscellaneous on Data Structures - Section 2
- Miscellaneous on Data Structures - Section 3
- Miscellaneous on Data Structures - Section 4
- Miscellaneous on Data Structures - Section 6
- Miscellaneous on Data Structures - Section 7
- Miscellaneous on Data Structures - Section 8
- Miscellaneous on Data Structures - Section 9
- Miscellaneous on Data Structures - Section 10
- Miscellaneous on Data Structures - Section 11
- Miscellaneous on Data Structures - Section 12