0% found this document useful (0 votes)
16 views

Java Interview qus.

Uploaded by

Ashwin jha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Java Interview qus.

Uploaded by

Ashwin jha
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Zero 2 infinity … February 18, 2015

Frequently asked Java Interview Programs


 Find the Count of numbers in the Given String "hey1234876hey"?
 Write a Java Program to Exchange Name is James to James is Name?
 Write a Java Program to reverse a String?
 Write a program that will read a float type value from the keyboard and print the following output.
->Small Integer not less than the number.
->Given Number.
->Largest Integer not greater than the number.
 Write a program to generate 5 Random nos. between 1 to 100, and it should not follow with decimal
point.
 Write a program to Find Factorial of Given no.
 Write a program to Reverse a given no.
 Write a program to Reverse a given no.
 Write a program to find sum of all integers greater than 100 and less than 200 that are divisible by 7.
 Program to Display Multiplication Table.
 Write a program to Swap the values.
 Write a program to convert given no. of days into months and days.
(Assume that each month is of 30 days)
Example :Input - 69
Output - 69 days = 2 Month and 9 days
 Write a program to generate a Triangle.
eg:
1
22
333
4 4 4 4 and so on as per user given number
 Write a program to Display Invert Triangle.
Example:
Input - 5

By : Shailesh Kumar (+91-9764975157)


Zero 2 infinity … February 18, 2015

Output :
55555
4444
333
22
1
 Write a program to find whether given no. is Armstrong or not.
Example :
Input - 153
Output - 1^3 + 5^3 + 3^3 = 153, so it is Armstrong no.
 Write a program to find whether no. is palindrome or not.
Example :
Input - 12521 is a palindrome no.
Input - 12345 is not a palindrome no.
 Write a program to generate Harmonic Series.
Example :
Input - 5
Output - 1 + 1/2 + 1/3 + 1/4 + 1/5 = 2.28 (Approximately)
 Write a program to find average of consecutive N Odd no. and Even no.
 Display Triangle as follow : BREAK DEMO.
1
23
456
7 8 9 10 ... N
 Display Triangle as follow
0
10
101
0101

By : Shailesh Kumar (+91-9764975157)


Zero 2 infinity … February 18, 2015

 Display Triangle as follow


1
24
369
4 8 12 16 ... N (indicates no. of Rows)
 WAP for perfect number?
 Write a program to find out duplicate or repeated characters in a string, and calculate the count of
repeatation.
 Write a program to find top two maximum numbers in the given array. You should not use any sorting
functions. You should iterate the array only once. You should not use any kind of collections in java.
 Sort or order a HashMap or TreeSet or any map item by value. Write a comparator which compares by
value, not by key. Entry class might hleps you here.
 Write a program to identify common elements or numbers between two given arrays. You should not
use any inbuilt methods are list to find common values.
 how to find out sum of each digit in the given number using recursion logic. For example, if the number
is 259, then the sum should be 2+5+9 = 16.
 Write a program for Bubble Sort in java.
 Write a program for Insertion Sort in java.
 How to get distinct elements from an array by avoiding duplicate elements?
 Write a program to get distinct word list from the given file.
 Write a program to get a line with max word count from the given file.
 Write a program to convert string to number without using Integer.parseInt() method.
 Write a program to find the sum of the first 1000 prime numbers
 Find longest substring without repeating characters.
 Write a program to remove duplicates from sorted array.

By : Shailesh Kumar (+91-9764975157)

You might also like