Vidyalelo
Data Structure · Q558

Miscellaneous on Data Structures

Programming · Data Structure · question 558

Q558

What will be the output of the following code? #include #include using namespace std; void func1(string input,string output) if(input.length()==0) cout<<output<<","; return; for(int i=0;i<=output.length();i++) func1(input.substr(1),output.substr(0,i) + input[0] + output.substr(i)); int main() char str[] = "AB"; func1(str, ""); return 0;

A.
AA,BA,
B.
AB,BA,
C.
BA,AB,
Answer
D.
AB,AB,

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board