QUESTION BASED ON If Condition
Worksheet -2
Q1 Name the keyword which helps in working code involves condition.
Q2 Write the syntax of simple if statement.
Q3. Is there any limit of statement that can appear under an if block
Q4. Write a program to check whether a person is eligible for voting or not.
Q5. Write a program to check whether a number entered by user is even or odd
Q6. Write a program to check whether a number is divisible by 7 or not
Q7. Write a program to display “Hello” if number entered by user is a multiple of five
Q8. Write a program to calculate the electricity bill (accept number of unit from user) according to the following criteria:
Unit Price
First 100 units no charge
Next 100 units Rs 5 per unit
After 200 units Rs 10 per unit
(For example if input is 350 than bill amount is Rs 2000)
Q9. Write a program to display the last digit of a number.
Q10. Write a program to check whether the last digit of a number divisible by 3 or not.
Q11. Write a program to accept percentage from user and display the grade according to the following criteria.
Marks Grade
>90 A
>80 and <=90 B
>=60 and <=80 C
Below 60 D
Q12. Write a program to accept the cost price of a bike and display the road tax to be paid according to the following criteria:
Cost price (in Rs) Tax
>100000 15%
>50000 and <=100000 10%
<=50000 5%
Q13. Write a program to check whether an years is leap year or not.
Q14. Write a program to accept a number from 1 to 7 and display the name of the name of the day like 1 for Sunday, 2 for
Monday and so on.
Q15. Write the logical expression for the following:
A is greater than B and C is greater than D
Q16. Write a program to check whether a number is positive or negative.
Q17. Write a program to whether a number is divisible by 2 and 3
Q18. Evaluate the following statement
a=True
b=True
c=True
d=True
1. print(c)
2.print(d)
3. print(not a)
4. print (not b)
5. print (not c)
6. print (not d)
7. print (a and b)
8. print (a or b)
9. print (a and c)
10. print (a or c)
11. print (a and d)
12. print (a or d)
13. print (b and c)
14. print (b or c)
15. print (a and b or c)
16. print (a or b and c)
17. print (a and b and c)
18. print (a or b or c)
19. print (not a and b and c)
20. print (not a or b or c)