CS PRACTICAL FILE
CS PRACTICAL FILE
Output:
Ques 2. Write a program using a user defined function
myMean() to calculate the mean of floating values
stored in a list.
Answer:
Output:
Answer:
Output:
Output:
Ques 5. The company performs the following tasks to
fix the selling price of each tent.
1. Accept user requirements for the tent, such as
a) height
b) radius
c) slant height of the conical part
2. Calculate the area of the canvas used
3. Calculate the cost of the canvas used for making the
tent
4. Calculate the net payable amount by the customer
that is inclusive of the 18% tax. Write separate user
defined functions for part 2,3 and 4.
Ans:
Output:
Output:
Ques 7. Create a user defined module basic_math that contains the
following user defined functions:
1. To add two numbers and return their sum.
2. To subtract two numbers and return their difference.
3. To multiply two numbers and return their product.
4. To divide two numbers and return their quotient and print
“Division by Zero” error if the denominator is zero.
Also add a docstring to describe the module. After creating the
module, import and execute functions at shell prompt.
Answer:
Output:
Ans:
Ans:
Ques 11. Write a program in python to Reverse and
display each line of text.
Ans:
TABLE : GRADUATE
D.
e. Display a report, listing NAME, STIPEND, SUBJECT and amount of stipend received in a year
assuming that the STIPEND is paid every month.
Table: Loan_Accounts
Write SQL commands for the tasks 1 to 35
7. Display the AccNo and Loan_Amount of all the loans started before 01-04-2009.
9. Display the details of all the loans whose rate of interest is NULL.
10. Display the details of all the loans whose rate of interest is not NULL.
11. Display the amounts of various loans from the table Loan_Accounts. A loan amount
12. Display the number of instalments of various loans from the table Loan_Accounts. An
instalment should appear only once.
13. Display the details of all the loans started after 31-12-2008 for which the number of
instalments are more than 36.
14. Display the Cust_Name and Loan_Amount for all the loans which do not have number of
instalments 36.
15. Display the Cust_Name and Loan_Amount for all the loans for which the loan amount is less
than 500000 or int_rate is more than 12.
16. Display the details of all the loans which started in the year 2009.
17. Display the details of all the loans whose Loan_Amount is in the range 400000 to 500000.
18. Display the details of all the loans whose rate of interest is in the range 11% to 12%.
19. Display the Cust_Name and Loan_Amount for all the loans for which the number of
instalments are 24, 36, or 48. (Using IN operator).
20. Display the details of all the loans whose Loan_Amount is in the range 400000 to 500000.
(Using BETWEEN operator).
21. Display the details of all the loans whose rate of interest is in the range 11% to 12%.(Using
BETWEEN operator).
22. Display the AccNo, Cust_Name, and Loan_Amount for all the loans for which the Cust_Name
ends with ‘Sharma’.
23. Display the AccNo, Cust_Name, and Loan_Amount for all the loans for which the Cust_Name
ends with ‘a’.
24. Display the AccNo, Cust_Name, and Loan_Amount for all the loans for which the Cust_Name
contains ‘a’.
25. Display the AccNo, Cust_Name, and Loan_Amount for all the loans for which the Cust_Name
does not contain ‘P’.
26. Display the AccNo, Cust_Name, and Loan_Amount for all the loans for which the Cust_Name
contains ‘a’as the second last character.
27. Display the details of all the loans in the ascending order of their Loan_Amount.
28. Display the details of all the loans in the descending order of their Start_Date.
29. Display the details of all the loans in the ascending order of their Loan_Amount and within
Loan_Amount in the descending order of their Start_Date.
30. Put the interest rate 11.50% for all the loans for which interest rate is NULL.
31. Increase the interest rate by 0.5% for all the loans for which the loan amount is more than
400000.
33. Delete the records of all the loans whose start date is before 2007.
35. Add another column Category of type CHAR(1) in the Loan table.
Q3. Create Database Work and activate it.
Create the table WORKER and add records as shown below. Write SQL
f. To display the number of employees in each department but number of employees should be
less than 3.
g. To display the sum of salary, average of salary, maximum and minimum salary of
e. To display the sum and average salary of the employees of grade ‘B’.
f. To display grade and maximum, minimum and average salary of each grade.
g. To display the sum, average, maximum and minimum of salary.
h. To display grade and the number of employees in each grade where the number of employees
are more than two.