Plz check answer should be NO, as flag is always false.
10th MCQ in Strings Quiz
Find the output:-
void f(){
string s=”abhuhba” ;
bool flag=false;
for(int i=0;i<s.length()/2;i++)
if(s[i]!=s[s.length()-1-i])flag=false;
if(flag)cout<<”YES”;
else cout<<”NO”;
}
I think the ans will be NO but given answer is YES
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.