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:
-
Check if a given number is even or odd.
-
Check if a given year is a leap year or not.
-
Check if a character is a vowel or a consonant.
-
Find the greatest among three numbers.
-
Check if a number is positive, negative, or zero.
-
Check if a character is uppercase or lowercase.
-
Check if a person is eligible to vote (age 18+).
-
Check if a number is divisible by both 3 and 5.
-
Check if a string is empty or not.
-
Determine grade based on marks (A, B, C, etc.).
-
Check if a triangle is valid based on its angles.
-
Find whether a year is a century year or not.
-
Check if a number is within a given range (e.g., 10 to 100).
-
Check if a given day number (1-7) maps to a weekday or weekend.
-
Check if a string starts with a capital letter.
-
Check if a number is a multiple of another number.
-
Validate if a password length is within a specified range.
-
Check if an input character is a digit, letter, or special character.
-
Check if two numbers are equal or not.
-
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
Post a Comment