KEMBAR78
Worksheet Conditional Statement | PDF | Electrical Circuits | Electronic Circuits
0% found this document useful (0 votes)
25 views4 pages

Worksheet Conditional Statement

Uploaded by

priyashwrath0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views4 pages

Worksheet Conditional Statement

Uploaded by

priyashwrath0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

SELECTION STATEMENT

OUTPUT QUESTIONS

Q1. Give the output:

a=3

a=a+1

if a>5:

print(a)

else:

print(a+5)

Q2. Give the output:

NoOfGirls = 4

NoOfBoys = 10

if ( NoOfBoys == 8 and NoOfGirls <= NoOfBoys ):

print("Great achievement")

else:

print("Greater achievement")

Q3. Give the output:

circle=5

rectangle=0

square=4

triangle = 0

if circle:

if rectangle or square:

print("Draw diagram")
elif not rectangle and not square:

print("Invalid diagram");

else:

if circle == rectangle or square == triangle:

print("Canvas Available")

print("Invisible diagram")

Q4. Give the output:

ch=3

if ch == 1:

print(“ Laptop”)

elif ch == 2:

print(“Desktop ”)

elif ch== 3:

print (“Notebook”)

else:

print(“Invalid Choice”)

Q1 Write a program to input a year in 4-digit form and check whether it is a


leap year or not and display proper message.

Hint: A leap year is exactly divisible by 4 except for century years (years ending
with 00). The century year is a leap year only if it is perfectly divisible by 400.

Q2. Write a program to input a character and swap it's case(i.e. If it is


lowercase letter, convert it to uppercase and vice versa).

Q3. Write a program to input a number, check whether it is positive or


negative and display the appropriate message.

Q4. Write a program to input cost price and selling price of an item and
calculate profit and loss on a transaction.
Q5. Write a program to input a number and check whether it is even or odd
and display the appropriate message.

Q6. Write a program to input two numbers and check whether both are
divisible by 5.

Q7. Write a program to input a number and check whether it is divisible by 8


or not. (If the last three digits of a whole number are divisible by 8, then the
entire number is divisible by 8.)

Q8. Write a program to read the age of a candidate and determine whether it
is eligible for casting his/her own vote.

Q9. Write a program to input a character and display whether it is a vowel or


a consonant.

IF-ELIF STATEMENT

Q10. Write a program to input co-efficients of a, b and c of a quadratic


equation ax2 + bx + c = 0, where a = 0. Discriminant, D = b2- 4ac.If
discriminant is 0 then print there is exactly one real root, if discriminant is
positive then print there are two distinct roots, if discriminant is negative then
print there are no real roots.

Q11. Write a program to input three sides of a triangle and display whether it
is EQUILATERAL, SCALENE, RIGHT ANGLED or ISOSCELES.

Q12. Write a program to accept a date(dd/mm/yyyy) and check for its


validity.

Q13. Write a program to input temperature of water and display its state
(Liquid, solid or gas).

Q14. Write a program to input a character and check whether a character is


an alphabet, digit or special character.

Q15. Write a program to read any day number in integer and display day
name in the word.

Q16. Write a program to input salary and calculate commission for the
salesman. The commission is calculated as follows:

Salary Comission

30001 onwards 15%


22001 - 30000 10%

12001 – 22000 7%

5001 – 12000 3%

0 - 5000 0%

Show/Hide Solution

Q17. Write a program to input the name, subject, salary and experience (in
years) of a teacher. An allowance is given according to the following
condition:

If salary >10,000 or experience > 10 years, allowance is 20% of salary.

If salary is in the range 5000-10000 and experience >5years, allowance is 15%


of salary.

If salary >3000, allowance is 10%.

Otherwise if salary <3000, allowance is 6%.

Find the total salary (salary+allowance) and print it along with other details.

Show/Hide Solution

Q18. Write a program to calculate and print the Electricity bill of a given
customer. The customer id., name and unit consumed by the user should be
taken from the keyboard and display the total amount to pay to the customer.
The charge are as follow:

Charge/
Unit
unit
upto 199 Free
200 and above but less than
@1.20
400
400 and above but less than
@1.60
600
600 and above @2.00

If bill exceeds Rs. 400 then a surcharge of 15% will be charged and the
minimum bill should be of Rs. 150/-

You might also like