Q661
What will be the output of the following code? #include #include #include 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;
A.
AA,
B.
AA,AA
C.
A,A
D.
AA,AA,
AnswerAnswer: Option D
Solution
Answer: Option D
No explanation is given for this question Let's Discuss on Board