edited by
577 views
4 votes
4 votes

What is the functionality of above function Do ( ) ?
a. Check whether string is odd palindrome
b. Check whether the string is even palindrome
c.  Check whether the string is palindrome
d.  None of the above

edited by

1 Answer

Best answer
4 votes
4 votes
Edit:

The correct answer would be D) none.

The reason is $gate1$ and $gate$ both point to the first character. So loop condition $gate1 < gate$ is already false and hence the loop breaks and the function returns 1.

The original answer was option C) by assuming (erroneously) that the while loop condition is $gate1 < gate2$, whereas the condition is $gate1 < gate$
edited by

Related questions

698
views
0 answers
2 votes
srestha asked Jan 28, 2019
698 views
void foo(int n) { for(i1=1;i1<=n;i1++) { for(i2=1;i2<=i1;i2++) { ....... { for(i6=1;i6<=i5;i6++) { count++; } } } } }Count initially 0.What is value returned by foo(8)?
602
views
2 answers
3 votes
Shamim Ahmed asked Dec 11, 2018
602 views
char *a = “MADEEASY”;char *b = “GATECSIT2019”;char *r = a;char *s = b;printf(“%d”, (int) strlen (b+3[r] – 1[s]));return 0; Whats the output? Answer given 8
810
views
2 answers
2 votes
Shamim Ahmed asked Dec 11, 2018
810 views
main(){ int S[6] = {126,256,512,1024,2048,4096}; int *x=(int *) (&S+1); printf (“%d”,x); }int is 4 bytes; array starts from 2000 .The answer is 2024 I am getting 2004...