i think answer wiil be option a because after the completion of while loop,value of s will remain same
Next_permutation
Please copy and paste the question here so that i can check.
Given the following code snippet :
string s = “bca”;
do {
cout << s << ’ ';
} while(next_permutation(s.begin(), s.end()));
cout << s;
What is the output of the given code?
bca cab cba abc
bca cab cba cba
bca bca bca bca
bca cab cba bca
Answer should be bca cab cba cba.
Initially you were having bca
next permutation of it is cab
next permutation of it is cba
Then it come out of the loop and again prints cba.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
but option a is correct in quiz
Dont worry…we have found some answers marked wrong. We are working on it.