Page 296 - Computer Science V2.0 Class 11
P. 296
6. Write a program that accepts from the user the values of three floating point variables a, b, c, and calculates roots
of a quadratic equation: ax + bx + c = 0 where a is not equal to zero. Use a user-defined function to calculate the
2
roots.
7. Write a program that takes the side of a square (in centimeters) and a character (either 'A' or 'P' ) as an input from the user.
The program should display the area or perimeter of the square, depending on whether the input character is A or P. Also,
the program should display an error message, if a character other than A or P is entered.
8. Write a user-defined function to read two numbers and return the positive difference between them.
9. Write a program that accepts the name and marks of a student as the input from the user and prints the grades according
to the percentage scored by the student. The user interaction with Python interpreter appears as follows:
Enter your Name: Veena Dua
Enter your Marks: 130
Enter Maximum marks in examination: 200
Your Grade is: B
Use the following table as a reference criteria.
Percentage Grade
>=90 A
>=75 and <90 B
>=60 and <75 C
>=40 and <60 D
>= 33 and <40 E
<33 F
Use user-defined functions to accept data and calculate grades.
10. Write a program to read a character and check whether it is an uppercase character, a lowercase character, or a digit. For
example, on reading J as the input character, the program should output:
J is an uppercase character.
11. Aishwarya has been assigned a project to find the Body Mass Index (BMI) of the students of her class. The formula to
calculate BMI is
BMI= weight (in kg) / height (in m) 2
Write a program that may assist Aishwarya in achieving the assigned task.
Assertion and Reasoning Based Questions
The following questions are assertion(A) and reasoning(R) based. Mark the correct choice as
a. Both A and R are true and R is the correct explanation of A
b. Both A and R are true and R is not the correct explanation of A
c. A is true but R is false
d. A is false but R is true
Assertion(A): An if statement is a simple statement.
Reasoning(R): A simple statement appears by itself in a line.
Case-based Questions
1. Rumpa is very particular about her body weight. Recently, her friend told her that Body Mass Index(BMI) is the correct
2
measure of your body fat. The formula to calculate BMI is (weight/height ), where weight is in kg and height is in meters.
Rumpa wants to develop a program in Python that accepts weight in kilograms and height in meters and calculates BMI.
282 Touchpad Computer Science (Ver. 2.0)-XI

