Skip to main content

Interview Coding Question For software developer in all language || Written test question in exam of developer

Interview Coding Question For  software developer in all language || Written test question in exam of developer

====================================
Write a Java program to perform input/output of all basic data types.

Write a Java program to enter two numbers and find their sum.

Write a Java program to enter two numbers and perform all arithmetic operations.

Write a Java program to enter length and breadth of a rectangle and find its perimeter.
Write a Java program to enter length and breadth of a rectangle and find its area.
Write a Java program to enter radius of a circle and find its diameter, circumference and area.
Write a Java program to enter length in centimeter and convert it into meter and kilometer.
Write a Java program to enter temperature in Celsius and convert it into Fahrenheit.
Write a Java program to enter temperature in Fahrenheit and convert to Celsius
Write a Java program to convert days into years, weeks and days.
Write a Java program to find power of any number x ^ y.
Write a Java program to enter any number and calculate its square root.
Write a Java program to enter two angles of a triangle and find the third angle.
Write a Java program to enter base and height of a triangle and find its area.
Write a Java program to calculate area of an equilateral triangle.
Write a Java program to enter marks of five subjects and calculate total, average and percentage.
Write a Java program to enter P, T, R and calculate Simple Interest.
Write a Java program to enter P, T, R and calculate Compound Interest.




Write a Java program to check Least Significant Bit (LSB) of a number is set or not.

Write a Java program to check Most Significant Bit (MSB) of a number is set or not.

Write a Java program to get nth bit of a number.
Write a Java program to set nth bit of a number.
Write a Java program to clear nth bit of a number.
Write a Java program to toggle nth bit of a number.
Write a Java program to get highest set bit of a number.


Write a Java program to get lowest set bit of a number.
Write a Java program to count trailing zeros in a binary number.

Write a Java program to count leading zeros in a binary number.

Write a Java program to flip bits of a binary number using bitwise operator.

Write a Java program to count total zeros and ones in a binary number.

Write a Java program to rotate bits of a given number.

Write a Java program to convert decimal to binary number system using bitwise operator.
Write a Java program to swap two numbers using bitwise operator.
Write a Java program to check whether a number is even or odd using bitwise operator.



Write a Java program to find maximum between two numbers using conditional operator.
Write a Java program to find maximum between three numbers using conditional operator.
Write a Java program to check whether a number is even or odd using conditional operator.
Write a Java program to check whether year is leap year or not using conditional operator.
Write a Java program to check whether character is an alphabet or not using conditional operator.


Write a Java program to find maximum between two numbers.
Write a Java program to find maximum between three numbers.
Write a Java program to check whether a number is negative, positive or zero.
Write a Java program to check whether a number is divisible by 5 and 11 or not.
Write a Java program to check whether a number is even or odd.
Write a Java program to check whether a year is leap year or not.
Write a Java program to check whether a character is alphabet or not.
Write a Java program to input any alphabet and check whether it is vowel or consonant.
Write a Java program to input any character and check whether it is alphabet, digit or special character.
Write a Java program to check whether a character is uppercase or lowercase alphabet.
Write a Java program to input week number and print week day.
Write a Java program to input month number and print number of days in that month.
Write a Java program to count total number of notes in given amount.
Write a Java program to input angles of a triangle and check whether triangle is valid or not.
Write a Java program to input all sides of a triangle and check whether triangle is valid or not.
Write a Java program to check whether the triangle is equilateral, isosceles or scalene triangle.
Write a Java program to find all roots of a quadratic equation.
Write a Java program to calculate profit or loss.
Write a Java program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and Computer. Calculate percentage and grade according to following:
Percentage >= 90% : Grade A
Percentage >= 80% : Grade B
Percentage >= 70% : Grade C
Percentage >= 60% : Grade D
Percentage >= 40% : Grade E
Percentage < 40% : Grade F
Write a Java program to input basic salary of an employee and calculate its Gross salary according to following:
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary <= 20000 : HRA = 25%, DA = 90%
Basic Salary > 20000 : HRA = 30%, DA = 95%
Write a Java program to input electricity unit charges and calculate total electricity bill according to the given condition:
For first 50 units Rs. 0.50/unit
For next 100 units Rs. 0.75/unit
For next 100 units Rs. 1.20/unit
For unit above 250 Rs. 1.50/unit
An additional surcharge of 20% is added to the bill



Write a Java program to print day of week name using switch case.
Write a Java program print total number of days in a month using switch case.
Write a Java program to check whether an alphabet is vowel or consonant using switch case.
Write a Java program to find maximum between two numbers using switch case.
Write a Java program to check whether a number is even or odd using switch case.
Write a Java program to check whether a number is positive, negative or zero using switch case.
Write a Java program to find roots of a quadratic equation using switch case.
Write a Java program to create Simple Calculator using switch case.


Write a Java program to print all natural numbers from 1 to n. - using while loop
Write a Java program to print all natural numbers in reverse (from n to 1). - using while loop
Write a Java program to print all alphabets from a to z. - using while loop
Write a Java program to print all even numbers between 1 to 100. - using while loop
Write a Java program to print all odd number between 1 to 100.
Write a Java program to find sum of all natural numbers between 1 to n.

Write a Java program to find sum of all even numbers between 1 to n.

Write a Java program to find sum of all odd numbers between 1 to n.

Write a Java program to print multiplication table of any number.
Write a Java program to count number of digits in a number.
Write a Java program to find first and last digit of a number.
Write a Java program to find sum of first and last digit of a number.
Write a Java program to swap first and last digits of a number.
Write a Java program to calculate sum of digits of a number.
Write a Java program to calculate product of digits of a number.
Write a Java program to enter a number and print its reverse.
Write a Java program to check whether a number is palindrome or not.
Write a Java program to find frequency of each digit in a given integer.
Write a Java program to enter a number and print it in words.
Write a Java program to print all ASCII character with their values.
Write a Java program to find power of a number using for loop.
Write a Java program to find all factors of a number.
Write a Java program to calculate factorial of a number.
Write a Java program to find HCF (GCD) of two numbers.
Write a Java program to find LCM of two numbers.
Write a Java program to check whether a number is Prime number or not.
Write a Java program to print all Prime numbers between 1 to n.
Write a Java program to find sum of all prime numbers between 1 to n.
Write a Java program to find all prime factors of a number.
Write a Java program to check whether a number is Armstrong number or not.
Write a Java program to print all Armstrong numbers between 1 to n.
Write a Java program to check whether a number is Perfect number or not.
Write a Java program to print all Perfect numbers between 1 to n.
Write a Java program to check whether a number is Strong number or not.
Write a Java program to print all Strong numbers between 1 to n.
Write a Java program to print Fibonacci series up to n terms.
Write a Java program to find one's complement of a binary number.
Write a Java program to find two's complement of a binary number.
Write a Java program to convert Binary to Octal number system.
Write a Java program to convert Binary to Decimal number system.
Write a Java program to convert Binary to Hexadecimal number system.
Write a Java program to convert Octal to Binary number system.
Write a Java program to convert Octal to Decimal number system.
Write a Java program to convert Octal to Hexadecimal number system.
Write a Java program to convert Decimal to Binary number system.
Write a Java program to convert Decimal to Octal number system.
Write a Java program to convert Decimal to Hexadecimal number system.
Write a Java program to convert Hexadecimal to Binary number system.
Write a Java program to convert Hexadecimal to Octal number system.
Write a Java program to convert Hexadecimal to Decimal number system.
Write a Java program to print Pascal triangle upto n rows.
Star pattern programs - Write a Java program to print the given star patterns.
Number pattern programs - Write a Java program to print the given number patterns.




List of star pattern programming exercises
*****
*****
*****
*****
*****
Square Star Pattern

*****
*   *
*   *
*   *
*****
Hollow Square Star Pattern

*****
** **
* * *
** **
*****
Hollow Square Star Pattern with Diagonal

    *****
   *****
  *****
 *****
*****
Rhombus Star Pattern

    *****
   *   *
  *   *
 *   *
*****
Hollow Rhombus Star Pattern

*****
 *****
  *****
   *****
    *****
Mirrored Rhombus Star Pattern

*****
 *   *
  *   *
   *   *
    *****
Hollow Mirrored Rhombus Star Pattern

*
**
***
****
*****
Right Triangle Star Pattern

*
**
* *
*  *
*****
Hollow Right Triangle Star Pattern

    *
   **
  ***
 ****
*****
Mirrored Right Triangle Star Pattern

    *
   **
  * *
 *  *
*****
Hollow Mirrored Right Triangle Star Pattern

*****
****
***
**
*
Inverted Right Triangle Star Pattern

*****
*  *
* *
**
*
Hollow Inverted Right Triangle Star Pattern

*****
 ****
  ***
   **
    *
Inverted Mirrored Right Triangle Star Pattern

*****
 *  *
  * *
   **
    *
Hollow Inverted Mirrored Right Triangle Star Pattern

    *
   ***
  *****
 *******
*********
Pyramid Star Pattern

    *
   * *
  *   *
 *     *
*********
Hollow Pyramid Star Pattern

*********
 *******
  *****
   ***
    *
Inverted Pyramid Star Pattern

*********
 *     *
  *   *
   * *
    *
Hollow Inverted Pyramid Star Pattern

*
**
***
****
*****
****
***
**
*
Half Diamond Star Pattern

    *
   **
  ***
 ****
*****
 ****
  ***
   **
    *
Mirrored Half Diamond Star Pattern

    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *
Diamond Star Pattern

**********
****  ****
***    ***
**      **
*        *
*        *
**      **
***    ***
****  ****
**********
Hollow Diamond Star Pattern

*****
  ****
    ***
      **
        *
      **
    ***
  ****
*****
Right Arrow Star Pattern

    *****
   ****
  ***
 **
*
 **
  ***
   ****
    *****
Left Arrow Star Pattern

    +
    +
    +
    +
+++++++++
    +
    +
    +
    +
Plus Star Pattern

*       *
 *     *
  *   *
   * *
    *
   * *
  *   *
 *     *
*       *
X Star Pattern

 ***
*   *
*   *
*   *
 ***
*   *
*   *
*   *
 ***
Eight Star Pattern

  *****     *****
 *******   *******
********* *********
*******************
 *****************
  ***************
   *************
    ***********
     *********
      *******
       *****
        ***
         *
Heart Star Pattern

  *****     *****
 *******   *******
********* *********
*****Codeforwin****
 *****************
  ***************
   *************
    ***********
     *********
      *******
       *****
        ***
         *
Heart Star Pattern with Name




List of Number pattern programming exercises
Square number patterns
11111
11111
11111
11111
11111
Number pattern 1

11111
00000
11111
00000
11111
Number pattern 2

01010
01010
01010
01010
01010
Number pattern 3

11111
10001
10001
10001
11111
Number pattern 4

11111
11111
11011
11111
11111
Number pattern 5

10101
01010
10101
01010
10101
Number pattern 6

11011
11011
00000
11011
11011
Number pattern 7

10001
01010
00100
01010
10001
Number pattern 8

01110
10001
10001
10001
01110
Number pattern 9

11111
22222
33333
44444
55555
Number pattern 10

12345
12345
12345
12345
12345
Number pattern 11

12345
23456
34567
45678
56789
Number pattern 12

1  2  3  4  5
6  7  8  9  10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
Number pattern 13

55555
54444
54333
54322
54321
Number pattern 14

12345
23455
34555
45555
55555
Number pattern 15

12345
23451
34521
45321
54321
Number pattern 16

12345
21234
32123
43212
54321
Number pattern 17

5 5 5 5 5 5 5 5 5
5 4 4 4 4 4 4 4 5
5 4 3 3 3 3 3 4 5
5 4 3 2 2 2 3 4 5
5 4 3 2 1 2 3 4 5
5 4 3 2 2 2 3 4 5
5 4 3 3 3 3 3 4 5
5 4 4 4 4 4 4 4 5
5 5 5 5 5 5 5 5 5
Number pattern 18

1    2    3    4    5
16   17   18   19   6
15   24   25   20   7
14   23   22   21   8
13   12   11   10   9
Number pattern 19

Triangle Easy Number Patterns
1
22
333
4444
55555
Number pattern 20

55555
4444
333
22
1
Number pattern 21

11111
2222
333
44
5
Number pattern 22

5
44
333
2222
11111
Number pattern 23

1
12
123
1234
12345
Number pattern 24

12345
1234
123
12
1
Number pattern 25

1
21
321
4321
54321
Number pattern 26

54321
4321
321
21
1
Number pattern 27

5
54
543
5432
54321
Number pattern 28

54321
5432
543
54
5
Number pattern 29

5
45
345
2345
12345
Number pattern 30

12345
2345
345
45
5
Number pattern 31

1
23
345
4567
56789
Number pattern 32

56789
4567
345
23
1
Number pattern 33

13579
3579
579
79
9
Number pattern 34

Triangle 0,1 Easy Number Patterns
1
10
101
1010
10101
Number pattern 35

1
00
111
0000
11111
Number pattern 36

1
01
010
1010
10101
Number pattern 37

1
11
101
1001
11111
Number pattern 38

Triangle Hard Number Patterns
1
123
12345
1234567
123456789
Number pattern 39

1
24
135
2468
13579
Number pattern 40

1
131
13531
1357531
135797531
Number pattern 41

2
242
24642
2468642
2468108642
Number pattern 42

1
121
12321
1234321
123454321
Number pattern 43

1
32
4543
567654
67898765
Number pattern 44

1
2  3
4  5  6
7  8  9  10
11 12 13 14 15
Number pattern 45

1
21
123
4321
12345
Number pattern 46

1
23
4567
89123456
7891234567891234
Number pattern 47

1        1
12      21
123    321
1234  4321
1234554321
Number pattern 48

1  
2  6
3  7  10
4  8  11 13
5  9  12 14 15
Number pattern 49

1
2  4
7  11 16
22 29 37 46
56 67 79 92 106
Number pattern 50

1
3  2
4  5  6
10 9  8  7
11 12 13 14 15
Number pattern 51

1
22
333
2222
11111
Number pattern 52

N = 12345

12345
1234
123
12
1
Number pattern 53

N = 12345

12345
2345
345
45
5
Number pattern 54

Diamond Number Patterns
1
12
123
1234
12345
1234
123
12
1
Number pattern 55

1
123
12345
1234567
123456789
1234567
12345
123
1
Number pattern 56

1
121
12321
1234321
123454321
1234321
12321
121
1
Number pattern 57

*
*1*
*121*
*12321*
*1234321*
*123454321*
*1234321*
*12321*
*121*
*1*
*
Number pattern 58

Tricky Number Patterns
1       1
 2     2
  3   3
   4 4
    5
   4 4
  3   3
 2     2
1       1
Number pattern 59





List of  method  and recursion programming exercises
Write a Java program to find cube of any number using  method .
Write a Java program to find diameter, circumference and area of circle using  method s.
Write a Java program to find maximum and minimum between two numbers using  method s.
Write a Java program to check whether a number is even or odd using  method s.
Write a Java program to check whether a number is prime, Armstrong or perfect number using  method s.
 
Write a Java program to find all prime numbers between given interval using  method s.
Write a Java program to print all strong numbers between given interval using  method s.
Write a Java program to print all Armstrong numbers between given interval using  method s.
Write a Java program to print all perfect numbers between given interval using  method s.
 
Write a Java program to find power of any number using recursion.
Write a Java program to print all natural numbers between 1 to n using recursion.
Write a Java program to print all even or odd numbers in given range using recursion.
Write a Java program to find sum of all natural numbers between 1 to n using recursion.
Write a Java program to find sum of all even or odd numbers in given range using recursion.
Write a Java program to find reverse of any number using recursion.
Write a Java program to check whether a number is palindrome or not using recursion.
Write a Java program to find sum of digits of a given number using recursion.
Write a Java program to find factorial of any number using recursion.
Write a Java program to generate nth Fibonacci term using recursion.
Write a Java program to find GCD (HCF) of two numbers using recursion.
Write a Java program to find LCM of two numbers using recursion.
 
Write a Java program to display all array elements using recursion.
Write a Java program to find sum of elements of array using recursion.
Write a Java program to find maximum and minimum elements in array using recursion.








List of array and matrix programming exercises
Write a Java program to read and print elements of array. - using recursion.
Write a Java program to print all negative elements in an array.
Write a Java program to find sum of all array elements. - using recursion.
Write a Java program to find maximum and minimum element in an array. - using recursion.
Write a Java program to find second largest element in an array.
Write a Java program to count total number of even and odd elements in an array.
Write a Java program to count total number of negative elements in an array.
Write a Java program to copy all elements from an array to another array.
Write a Java program to insert an element in an array.
Write a Java program to delete an element from an array at specified position.
Write a Java program to count frequency of each element in an array.
Write a Java program to print all unique elements in the array.
Write a Java program to count total number of duplicate elements in an array.
Write a Java program to delete all duplicate elements from an array.
Write a Java program to merge two array to third array.

Write a Java program to find reverse of an array.
Write a Java program to put even and odd elements of array in two separate array.
Write a Java program to search an element in an array.
Write a Java program to sort array elements in ascending or descending order.
Write a Java program to sort even and odd elements of array separately.
Write a Java program to left rotate an array.
Write a Java program to right rotate an array.
List of matrix programming exercises
Write a Java program to add two matrices.
Write a Java program to subtract two matrices.
Write a Java program to perform Scalar matrix multiplication.
Write a Java program to multiply two matrices.
Write a Java program to check whether two matrices are equal or not.
Write a Java program to find sum of main diagonal elements of a matrix.
Write a Java program to find sum of minor diagonal elements of a matrix.
Write a Java program to find sum of each row and column of a matrix.
Write a Java program to interchange diagonals of a matrix.
Write a Java program to find upper triangular matrix.
Write a Java program to find lower triangular matrix.
Write a Java program to find sum of upper triangular matrix.
Write a Java program to find sum of lower triangular matrix.
Write a Java program to find transpose of a matrix.
Write a Java program to find determinant of a matrix.
Write a Java program to check Identity matrix.
Write a Java program to check Sparse matrix.
Write a Java program to check Symmetric matrix.




List of string programming exercises
Write a Java program to find length of a string.
Write a Java program to copy one string to another string.
Write a Java program to concatenate two strings.
Write a Java program to compare two strings.

Write a Java program to convert lowercase string to uppercase.
Write a Java program to convert uppercase string to lowercase.
Write a Java program to toggle case of each character of a string.
 
Write a Java program to find total number of alphabets, digits or special character in a string.
Write a Java program to count total number of vowels and consonants in a string.
Write a Java program to count total number of words in a string.
Write a Java program to find reverse of a string.
Write a Java program to check whether a string is palindrome or not.
Write a Java program to reverse order of words in a given string.
Write a Java program to find first occurrence of a character in a given string.
Write a Java program to find last occurrence of a character in a given string.
Write a Java program to search all occurrences of a character in given string.
Write a Java program to count occurrences of a character in given string.
Write a Java program to find highest frequency character in a string.
Write a Java program to find lowest frequency character in a string.
Write a Java program to count frequency of each character in a string.
Write a Java program to remove first occurrence of a character from string.
Write a Java program to remove last occurrence of a character from string.
Write a Java program to remove all occurrences of a character from string.
Write a Java program to remove all repeated characters from a given string.
Write a Java program to replace first occurrence of a character with another in a string.
Write a Java program to replace last occurrence of a character with another in a string.
Write a Java program to replace all occurrences of a character with another in a string.
Write a Java program to find first occurrence of a word in a given string.
Write a Java program to find last occurrence of a word in a given string.
Write a Java program to search all occurrences of a word in given string.
Write a Java program to count occurrences of a word in a given string.
Write a Java program to remove first occurrence of a word from string.
Write a Java program to remove last occurrence of a word in given string.
Write a Java program to remove all occurrence of a word in given string.
 
Write a Java program to trim leading white space characters from given string.
Write a Java program to trim trailing white space characters from given string.
Write a Java program to trim both leading and trailing white space characters from given string.
Write a Java program to remove all extra blank spaces from given string.



Comments

Popular posts from this blog

How to Send OTP in Mobile Number | login with OTP mobile Number | How to send OTP in mobile no with Spring Boot APP

   ðŸ˜‚               Login with Mobile Number OTP ---------------------------------------------------------------------------- If you want to develop a project to log in with OTP mobile Number in Spring Boot Applications then this post for you. In this post, I am going to use some other service to send the OTP in mobile number. we have to use it in this project spring boot. we are going to use Twilio to send SMS. we are going to use a web socket to send the data from the browser to the SMS gateway. Oracle Database for store the user details. <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> <version>2.3.3.RELEASE</version> </dependency> <dependency> <groupId>com.twilio.sdk</grou

Spring Boot With MySQL Database connection with Examples | MySQl Database Configuration with Spring Boot Projects

 ðŸ˜ƒ MySQL Database Configuration with Spring Boot Projects  In this article, we are going to introduce How to connect MySQL Database with the Spring Boot project. pom.xml   <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.projectlombok</gro

How can we create Auto generated field or ID for mongodb using spring boot

😂 How can we create an Auto-generated field or ID for MongoDB using spring boot? First Create One Application Like Mongodb_sequence-id-generator Pom.XML <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> </dependency> <dependency> <groupId>de.flapdoodle.embed</groupId> <artifactId>de.flapdoodle.embed.mongo</artifactId> </dependency> User.java package com.app; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Transient; import org.springframework.data.mongodb.core.mapping.Document; @Document(collection = "users_db") public class User { @Transient public static final String SEQUENCE_NAME = &