ALLInterview.com :: Home Page            
 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                      
Google
   
 
Categories >> Software >> Scripts >> JavaScript
 
 


 

 
 PHP interview questions  PHP Interview Questions (659)
 ASP interview questions  ASP Interview Questions (251)
 CGI Perl interview questions  CGI Perl Interview Questions (76)
 JavaScript interview questions  JavaScript Interview Questions (175)
 VB Script interview questions  VB Script Interview Questions (343)
 JSP interview questions  JSP Interview Questions (100)
 Shell Script interview questions  Shell Script Interview Questions (158)
 Python interview questions  Python Interview Questions (5)
 Tcl interview questions  Tcl Interview Questions (19)
 Awk interview questions  Awk Interview Questions (6)
 AJAX interview questions  AJAX Interview Questions (24)
 Ruby on Rails interview questions  Ruby on Rails Interview Questions (21)
 Scripts AllOther interview questions  Scripts AllOther Interview Questions (48)
Question
Write a program  to check whether a given number is  a
palindrome or not?
 Question Submitted By :: JavaScript
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
This Script checks the given number as well as string is palindrome or not


<html>
<body>
<script type="text/javascript">
function checkPalindrome() {
var revStr = "";
var str = document.getElementById("str").value;
var i = str.length;
for(var j=i; j>=0; j--) {
revStr = revStr+str.charAt(j);
}
if(str == revStr) {
alert(str+" -is Palindrome");
} else {
alert(str+" -is not a Palindrome");
}
}
</script>
<form >
Enter a String/Number: <input type="text" id="str" name="string" /><br />
<input type="submit" value="Check" onclick="checkPalindrome();"/>
</form>
</body>
</html>
 
Is This Answer Correct ?    142 Yes 27 No
Upendar
 
Answer
# 2
malayalam 
Is This Answer Correct ?    24 Yes 10 No
Srikanth
 
 
 
Answer
# 3
<html>
<head>
<script language="Javascript">
var a;
</script>
<title> Number Palindrom </title>
</head>
<body>
<script Language="Javascript">
var rno=0;
var r=0;
var no = prompt("Enter First no: ","10");
var ono = parseInt(no);
while (no>0)
{
r = parseInt(no%10);
rno = parseInt((rno*10)+r);
no = parseInt(no/10);
}
document.write(rno);
if(rno == ono)
{
document.write(ono+" is palindrom number..");
}
else
{
document.write(ono +" is not palindrom number..");
}
</script>
</body>
</html>
 
Is This Answer Correct ?    15 Yes 6 No
Riddhi
 
Answer
# 4
num=InputBox ("Enter a number")
z=num
r=0
While(num>0)
rem1=num mod 10
num=num\10
r=(r*10) + rem1

Wend

If (r=z)Then
Msgbox "Given no is palindrome"
else
Msgbox "Given no. is not palindrome"

End If
 
Is This Answer Correct ?    7 Yes 3 No
Sharma V
 
Answer
# 5
1221 
Is This Answer Correct ?    0 Yes 0 No
Ss
 

 
 
 
Other JavaScript Interview Questions
 
  Question Asked @ Answers
 
if the two text boxes are there i want assign the vales like 2&3 and if i select button means i want find the sum.this is client side scripting in javascript Infosys 7
what is the need of javascript in the internet   1
What is the difference between java and java script? Wipro 9
Write a program to check whether a given number is a palindrome or not?   5
How to include the HTML tag inside the javascript tags? TCS 4
how can we create own web browser? Infosys 1
different between web server and application server NIIT 1
Can you tell me how to send email using javascript?   2
How to add a combo box dynamically at run time in Java script?   5
What is negative infinity? Satyam 2
Hi Friends, I am new to java, please provide some use full docs, and where can i get basic Java script docs... thanx in advance   8
How can we send mail using Javascript?   1
 
For more JavaScript Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com