10th MCQ in Strings Quiz

Plz check answer should be NO, as flag is always false.

@manikNFt can you please tell me the wuestion as I have no acess to it ,I will explain you.

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

@manikNFt yes answer will be No ,shayad koi mistake ho gyi hai question me.

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.