ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
Find string palindrome 10marks

 Question Submitted By :: Nazim
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Find string palindrome 10marks
Answer
# 1
void main()
{
 int a,len,palin;
 char s[20];
 
 scanf("%s",s);
 
 len=strlen(s);
 printf("%d \n",len);
 
 for(a=0,len=len-1;a<len;a++,len--)
 {
     if(s[a]==s[len])
         palin=1;
      
	  else 
           break;
 }

  if(palin==1)
     printf("string %s is palindrome",s);
 else
      printf("string %s is not palindrome",s);

getch();

}
 
Is This Answer Correct ?    3 Yes 2 No
Babitha
 
  Re: Find string palindrome 10marks
Answer
# 2
#include <stdio.h>

int isPalindrome ( char* str, int nLength )
{
	if ( nLength < 1 ) return ( 1 );
	if ( str [0] == str [ nLength -1 ] ) return ( 
isPalindrome ( ( str + 1 ) , ( nLength - 2 ) ) );
	else return ( 0 );
}

int main (int argc, char* argv[])
{
	char a[10] = {"ropepor"};
	if ( isPalindrome  ( a, strlen ( a ) ) ) printf 
("\n The string is Palindrome");
	else printf ("\n The string is NOT Palindrome");
	return (1 );
 
Is This Answer Correct ?    1 Yes 2 No
Abdur Rab
 
 
 
  Re: Find string palindrome 10marks
Answer
# 3
void main()
{
 int a,len,palin;
 char s[20];
 
 scanf("%s",s);
 
 len=strlen(s);
 printf("%d \n",len);
 
 for(a=0,len=len-1;a<len;a++,len--)
 {
    palin=0;
     if(s[a]==s[len])
         palin=1;
      
	  else
{ 
printf("string %s is not palindrome",s);
getch();
exit();
}
  }
printf("string %s is palindrome",s);    
getch();

}
 
Is This Answer Correct ?    1 Yes 0 No
Coolcom(chandan)
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
What is #pragma directive?how it is used in the program? what is its advantages and disadvantages?  1
How can I invoke another program from within a C program?  1
what is the return value (status code) of exit() function.... what the arguments(integer value) passed to it means.... TCS1
will u give me old quesrion papers for aptitude for L & t info tech? L&T1
#define min((a),(b)) ((a)<(b))?(a):(b) main() { int i=0,a[20],*ptr; ptr=a; while(min(ptr++,&a[9])<&a[8]) i=i+1; printf("i=%d\n",i);}  2
Read N characters in to an array . Use functions to do all problems and pass the address of array to function. 1. Print only the alphabets . If in upper case print in lower case vice versa.  1
compute the nth mumber in the fibonacci sequence? TCS6
what is the defrenece between structure and union  4
i want explaination about the program and its stack reprasetaion fibbo(int n) { if(n==1 or n==0) return n; else return fibbo(n-1)+fibbo(n-2); } main() { fibbo(6); }  2
int a=2,b=3,c=4; printf("a=%d,b=%d\n",a,b,c); what is the o/p? Verifone4
what is y value of the code if input x=10 y=5; if (x==10) else if(x==9) elae y=8; a.9 b.8 c.6 d.7 TCS1
How can I access memory located at a certain address?  2
When is an interface "good"?  1
why we shiuld use main keyword in C  4
How can I prevent other programmers from violating encapsulation by seeing the private parts of my class?  1
How would you print out the data in a binary tree, level by level, starting at the top?  3
WAP TO ACCEPT STRING AND COUNT A COMES N TIMES B COMES N TIMES C COMES N TIMES D COMES N TIMES AND SO ON......... AT LAST UNTIL Z COMES N TIMES...............  2
to find the program of matrix multiplication using arrays  1
what information does the header files contain? BSNL4
what is dangling pointer? LG-Soft1
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com