✅ 50 Java Programs for SDET Interviews

 

50 Java Programs for SDET Interviews

  1. Write a program to check if a number is positive or negative.

  2. Write a program to find the greatest of two numbers.

  3. Write a program to find the greatest among three numbers.

  4. Write a program to check if a number is even or odd.

  5. Write a program to check if a year is a leap year.

  6. Write a program to check if a character is a vowel or consonant.

  7. Write a program to check if a number is divisible by 5 and 11.

  8. Write a program to check if a character is uppercase or lowercase.

  9. Write a program to check if a number is a multiple of both 3 and 7.

  10. Write a program to print "Pass" if marks are above 40, else print "Fail".

  11. Write a program to find the maximum of four numbers.

  12. Write a program to check if a number lies between 100 and 200.

  13. Write a program to check if a character is an alphabet.

  14. Write a program to calculate the absolute value of a number.

  15. Write a program to print day name based on day number (1-7).

  16. Write a program to print grade based on marks (using if-else ladder).

  17. Write a program to check if a triangle is valid using three angles.

  18. Write a program to swap two numbers using a function.

  19. Write a program to check if a number is prime using a function.

  20. Write a program to calculate the factorial of a number using a function.

  21. Write a program to check if a number is palindrome (e.g., 121).

  22. Write a program to check if a string is palindrome.

  23. Write a program to count the number of digits in a number.

  24. Write a program to sum digits of a given number (e.g., 123 ➔ 6).

  25. Write a program to reverse a given number.

  26. Write a program to reverse a string without using inbuilt methods.

  27. Write a program to find the largest digit in a number.

  28. Write a program to print numbers from 1 to N using a function.

  29. Write a program to print all even numbers between 1 and 100.

  30. Write a program to print multiplication table of a number using function.

  31. Write a program to calculate sum of first N natural numbers.

  32. Write a program to find sum of even numbers between 1 to N.

  33. Write a program to check if the sum of two numbers is greater than 100.

  34. Write a program to find the smallest among three numbers.

  35. Write a program to convert Celsius to Fahrenheit using function.

  36. Write a program to calculate simple interest using function.

  37. Write a program to check if a string contains only digits.

  38. Write a program to count vowels and consonants in a string.

  39. Write a program to check if a number is Armstrong (e.g., 153 ➔ 1³+5³+3³=153).

  40. Write a program to print Fibonacci series up to N terms using function.

  41. Write a program to check if a number is strong number (e.g., 145 ➔ 1!+4!+5!).

  42. Write a program to print all prime numbers between 1 and N.

  43. Write a program to find GCD (greatest common divisor) of two numbers.

  44. Write a program to find LCM (least common multiple) of two numbers.

  45. Write a program to check if a character is special symbol (!,@,#,...).

  46. Write a program to count number of uppercase and lowercase letters in a string.

  47. Write a program to print sum of squares of first N natural numbers.

  48. Write a program to print pattern of stars (triangle) using loops.

  49. Write a program to check if two numbers are co-prime.

  50. Write a program to print sum of digits until the result is a single digit (e.g., 9875 ➔ 9+8+7+5=29 ➔ 2+9=11 ➔ 1+1=2).


๐ŸŽฏ Special: Why These Are Picked

✔️ All require correct conditional statements (if, else, else if)
✔️ Require relational operators (==, >, <, >=, <=, !=)
✔️ Test syntax (curly braces, semicolons) — errors if you miss!
✔️ Involve functions (define, call, return, trace)
✔️ Are actual coding test and SDET automation logic favorites (e.g., palindrome, prime, reverse)

Comments

Popular posts from this blog

10 automation test cases for https://www.saucedemo.com/ (Sauce Demo)

Java Roadmap for SDET Superstars!

Mastering XPath in Selenium 4 ๐Ÿš€ – Supported Functions & Axes Explained