Java Tutorial: Practice Questions On Conditionals & Switch Case
Practice Set
Question 1 : What will be the output of this program:
Question 2: Write a program to find out whether a student is pass or fail; if it requires a total of 40% and at least 33% in each subject to pass. Assume 3 subjects and take marks as input from the user.
Question 3 :Calculate income tax paid by an employee to the government as per the slabs mentioned below:
| Income Slab | Tax |
| 2.5L – 5.0L | 5% |
| 5.0L – 10.0L | 20% |
| Above 10.0L | 30% |
Note that there is not tax below 2.5L. Take the input amount as input from the user.
Question 4: Write a Java program to find out the day of the week given the number [1 for Monday, 2 for Tuesday … and so on!]
Question 5:Write a Java program to find whether a year entered by the user is a leap year or not.
Question 6:Write a program to find out the type of website from the URL:
- .com – commercial website
- .org – organization website
- .in – Indian website
Ultimate Java Cheatsheet: Click To Download