Java Programming Interview Questions

Hi Folks, In today blog i am going to share basic programming interview question on java which interviewer asking in campus selection process This is one round of 10 questions i am sharing with you. Soon i will post 10 more java programming questions which recently asked in campus interview.

Program 1 : Factorial Program in Java ?

Factorial of n is donated by n!. For example.

4! = 4*3*2*1 = 24

5! = 5*4*3*2*1 = 120

Solution –

Program 2:-  Fibnocci series program in Java ?

In fibonacci series, next number is the sum of previous two numbers for example 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 etc.

Solution- 

Problem 3:- Armstrong Number in Java ?

Armstrong Number in Java: Armstrong number is a number that is equal to the sum of cubes of its digits for example 0, 1, 153, 370, 371, 407 etc.

153 = (1*1*1)+(5*5*5)+(3*3*3)

where:

(1*1*1)=1

(5*5*5)=125

(3*3*3)=27

So:

1+125+27=153

Solution-

Problem 4: Palindrome Program in Java ?

A palindrome number is a number that is same after reverse. For example 545, 151, 34543, 343, 171, 48984 are the palindrome numbers.

Solution-

Problem 5:- String Reverse ?

Solution-

Problem 6:- Prime Number ?

Prime number is a number that is greater than 1 and divided by 1 or itself. In other words, prime numbers can’t be divided by other numbers than itself or 1. For example 2, 3, 5, 7, 11, 13, 17…. are the prime numbers.

Solution-

Problem 7:- Java Program to Reverse Array In Place ?

Solution-

Problem 8:- Determine If Year Is Leap Year Java Example ?

A leap year has 366 days. Algorithm to find a leap year
not a leap year else if year % 4 = 0,
if year % 400 = 0, leap year else if year % 100 = 0,
leap year
else,
not a leap year.

Solution –

Problem 9:- Check whether string is palindrome or not ?

Solution-

Problem 10:- Java program to remove duplicate words in a string ?

Solution –

 

 

 

Leave a Comment

%d bloggers like this: