20 if-else practice problems in Java

 20 if-else practice problems in Java, targeted towards SDET (Software Development Engineer in Test) skills but without solutions. Here they are:

  1. Check if a given number is even or odd.

  2. Check if a given year is a leap year or not.

  3. Check if a character is a vowel or a consonant.

  4. Find the greatest among three numbers.

  5. Check if a number is positive, negative, or zero.

  6. Check if a character is uppercase or lowercase.

  7. Check if a person is eligible to vote (age 18+).

  8. Check if a number is divisible by both 3 and 5.

  9. Check if a string is empty or not.

  10. Determine grade based on marks (A, B, C, etc.).

  11. Check if a triangle is valid based on its angles.

  12. Find whether a year is a century year or not.

  13. Check if a number is within a given range (e.g., 10 to 100).

  14. Check if a given day number (1-7) maps to a weekday or weekend.

  15. Check if a string starts with a capital letter.

  16. Check if a number is a multiple of another number.

  17. Validate if a password length is within a specified range.

  18. Check if an input character is a digit, letter, or special character.

  19. Check if two numbers are equal or not.

  20. Check if a number is prime or composite (basic version).

These focus on basic conditional logic using if-else blocks and are ideal for building logical foundations, especially for testing roles like SDET where validation conditions are key.

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