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                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C++  >>  C++ General
 
 


 

 
 STL interview questions  STL Interview Questions
 OOPS interview questions  OOPS Interview Questions
 C++ General interview questions  C++ General Interview Questions
Question
write program for palindrome
 Question Submitted By :: Vijay_it4all
I also faced this Question!!     Rank Answer Posted By  
 
  Re: write program for palindrome
Answer
# 1
#include<stdio.h>
#include<conio.h>
void main()
{
int n,s=0,m;
clrscr();
printf("enter any no");
scanf("%d",&n);
m=n;
while(n>0)
{
r=n%10;
s=s*10+r;
n=n/10;
}
if(m==n)
printf("the no is palindrome");
else
printf("no is not palindrome");
getch();
}
 
Is This Answer Correct ?    8 Yes 2 No
Md.irfan(rourkela)
 
  Re: write program for palindrome
Answer
# 2
#include<iostream.h>
#include<string.h>

int main()
{
     char str[25],str1[25];	
     cout<<"Enter a string: ";
	
     gets(str);

     strcpy(str1,str);
     strrev(str);
	if(strcmp(str,str1)!=0)
	{
	     cout<<"string is not palindrome";
	}
	else
	{
	      cout<<"string is a palindrome";
	}

	  cout<<endl;
 
Is This Answer Correct ?    10 Yes 0 No
Pallavi Attarde
 
 
 
  Re: write program for palindrome
Answer
# 3
String s1=args[0];
String s2="";

for(int i=0; i<s1.length(); i++)
{
   s2=s2+charAt(i);
}
if(s1.equals(s2))
  System.out.println("Palindrome");
else
  System.out.println("Not Palindrome");
 
Is This Answer Correct ?    2 Yes 0 No
Amrutha
 

 
 
 
Other C++ General Interview Questions
 
  Question Asked @ Answers
 
How to write Multithreaded applications using C++? Honeywell2
Write a String class which has: 1) default constructor 2) copy constructor 3) destructor 4) equality operator similar to strcmp 5) constructor which takes a character array parameter 6) stream << operator Lehman-Brothers1
Difference between Operator overloading and Functional overloading? HP3
write program for palindrome  3
class Foo { const int x; protected: Foo(int f); ~Foo(); }; Foo f; Referring to the sample code above, why will the class declaration not compile? a) The variable x is const. b) The destructor is protected. c) The destructor is not public. d) The constructor is protected. e) There is no default constructor. Quark4
this is to swap to strings....but in output the whole strings are swapped leaving first as it is...why it is so #include<iostream.h> int main() { char a[]="ajeet"; char b[]="singh"; long x=*a; long y=*b; cout<<x<<":"<<y; x=x+y; y=x-y; x=x-y; *a=x; *b=y; cout<<x<<":"<<y; cout<<&a<<endl; cout<<&b<<endl; }  1
wrong statement about c++ a)code removably b)encapsulation of data and code c)program easy maintenance d)program runs faster  8
what is pulse code modulation? Wipro1
How can you quickly find the number of elements stored in a a) static array b) dynamic array ? Lucent3
How do you know that your class needs a virtual destructor? Lucent3
const char * char * const What is the differnce between the above two? TCS8
What is a "RTTI"? HCL5
What is "map" in STL?  1
What are the different types of polymorphism?  2
What is the output of printf("%d")? HCL25
What will happen if I allocate memory using "new" and free it using "free" or allocate sing "calloc" and free it using "delete"?  2
What is the difference between operator new and the new operator? Wipro1
What is object slicing and how can we prevent it? Tech-Mahindra2
Why preincrement operator is faster than postincrement?  3
What are the types of STL containers?  1
 
For more C++ General 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