1.

The following is a function of some class which checks if a positive integer is a Palindrome number by returning true or false. (A number is said to be palindrome if the reverse of the number is equal to the original number.) The function does not use the modulus (%) operator to extract digit. There are some places in the code marked by ?1?, ?2?, ?3?, ?4?, ?5? which may be replaced by a statement/expression so that the function works properly.boolean PalindromeNum(int N) { int rev=?1?; int num=N; while(num>0) { int f=num/10; int s= ?2?; int digit = num-?3?; rev= ?4? + digit; num/= ?5?; } if(rev==N) return true; else return false; }1. What is the statement or expression at ?1? 2. What is the statement or expression at ?2? 3. What is the statement or expression at ?3? 4. What is the statement or expression at ?4? 5. What is the statement or expression at ?5?

Answer»

1. 0 

2. 0 

3. 1 

4. rev*10 

5. 10



Discussion

No Comment Found

Related InterviewSolutions