Netxd Software India Interview Questions

This blog explains about  Netxd Software India  Interview Questions and is given below

 NETXD SOFTWARE INDIA  PVT. LTD

1.Find a given Integer Palindrome or Not?

 import java.util.*;
 
public class Palindrome
{
    public static void main(String args[]){
        int num,tNum,sum;
         
        Scanner bf=new Scanner(System.in);
         
        //input an integer number
        System.out.print("Enter any integer number: ");
        num= bf.nextInt();
         
        //find reverse number
        tNum=num;
        sum =0;
        while(tNum>0)
        {
            sum = (sum*10) + (tNum%10);
            tNum/=10;
        }
         
        //check inputted number with reversed number
        if(num==sum)
            System.out.println(num + " is a Palindrome Number.");
        else
            System.out.println(num + " is not a Palindrome Number.");
    }
}

OUTPUT:

Enter any integer number: 12321
    12321 is a Palindrome Number.
Enter any integer number: 1234
    1234 is not a Palindrome Number.

2. Find a Second Largest Number In an given array?
Package com.candidjava;
public class SecondLargest
{
public static void main(String[] args)
{
int arr[] = { 14, 46, 47, 86, 92, 52, 48, 36, 66, 85 };
int largest = arr[0];
int secondLargest = arr[0];
System.out.println("The given array is:" );
for (int i = 0; i < arr.length; i++)
{
System.out.print(arr[i]+"\t");
}
for (int i = 0; i < arr.length; i++)
{
if (arr[i] > largest)
{
 secondLargest = largest;
 largest = arr[i];
}
else if (arr[i] > secondLargest) {
 secondLargest = arr[i];
}
}
System.out.println("\nSecond largest number is:" + secondLargest);
}
}

OUTPUT:

The given array is:

14464786925248366685

Second largest number is:86