ans is of type Indicate U boolean iterallUll any Code 2 whil


ans is of type Indicate U boolean. iterallUll! any Code 2) while s length if (s.charAt (i) s.charAt (r-i) ans true else false an State (Variable Valu abcdcbf ans false ans ans false false ans true, an ans false ans false

Solution

s.length()/2 = 7/2 = 3 ( as int is rounded to highest int lower than equal to number here 3.5)

Iteration 1 : i = 0 , r = 6 , ans = false as \'a\' != \'f\'

Iteration 2 : i = 1 , r = 6 , ans = true as \'b\' == \'b\'

Iteration 3 : i = 2 , r = 6 , ans = true as \'c\' == \'c\'

Iteration 4 : i = 3 stop as 3 < 3 is false in while

1. while loop i=0,1,2 , exit on i=3 , so while loop runs 3 times true,true,true,false

2. if is false , true , true , if runs twice for i = 1 , i =2 . as index1 has \'b\' and index 6-1 has \'b\' //ly for index 2 and 4 have \'c\'

3. else runs once for i =0 , ans = false

 ans is of type Indicate U boolean. iterallUll! any Code 2) while s length if (s.charAt (i) s.charAt (r-i) ans true else false an State (Variable Valu abcdcbf a

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site