61. What will be the output of the 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[] = "AA";
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[] = "AA";
int n = strlen(str);
func(str, 0, n-1);
return 0;
}
62. How many solutions are there for 8 queens on 8*8 board?
63. How many times is the function recursive_sum_of_digits() called when the following code is executed?
#include<stdio.h>
int recursive_sum_of_digits(int n)
{
if(n == 0)
return 0;
return n % 10 + recursive_sum_of_digits(n/10);
}
int main()
{
int n = 1201;
int ans = recursive_sum_of_digits(n);
printf("%d",ans);
return 0;
}
#include<stdio.h>
int recursive_sum_of_digits(int n)
{
if(n == 0)
return 0;
return n % 10 + recursive_sum_of_digits(n/10);
}
int main()
{
int n = 1201;
int ans = recursive_sum_of_digits(n);
printf("%d",ans);
return 0;
}
64. The problem of finding a list of integers in a given specific range that meets certain conditions is called?
65. A vertex in a graph, on the removal of whose increases the number of connected components is called?
66. Which of the following is also known as GCD?
67. The most important condition for which closest pair is calculated for the points (pi, pj) is?
68. What will be the time complexity of the following code?
int xpowy(int x, int n)
{
if (n==0)
return 1;
if (n==1)
return x;
if ((n % 2) == 0)
return xpowy(x*x, n/2);
else
return xpowy(x*x, n/2) * x;
}
int xpowy(int x, int n)
{
if (n==0)
return 1;
if (n==1)
return x;
if ((n % 2) == 0)
return xpowy(x*x, n/2);
else
return xpowy(x*x, n/2) * x;
}
69. Encryption in Autokey cipher is done using . . . . . . . .
70. Cross product is a mathematical operation performed between . . . . . . . .
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 5
- Miscellaneous on Data Structures - Section 6
- 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