Practical 12 File-1
Practical 12 File-1
PRACTICAL FILE
COMPUTER SCIENCE
2024-25
INDEX
S. SIGNATU
NO NAME OF THE PROGRAM RE
1 Write a python function to compute the area of rectangle. Function
should return a value
2 Write a python function to calculate factorial of a given number.
3 Write a python function to add and subtract two values and return
the calculated result.
4 Write a python function to compute the basic calculation
performed by a calculator.
5 Write a python function to calculate the sum and product of first 10
natural numbers.
6 Write a python function with name “compute_volume” which will
perform the following function:
It will ask the user to input diameter of a sphere.
Calculate the volume of sphere.
Print the statement which will display with a proper
message of volume of sphere.
Function should return a value.
7 Write a python menu driven function to compute basic calculation
performed by a calculator.
8 Write a python function to accept a string as an input and to count
and display the total number of vowels present in it.
9 Write a python function to accept string as an input and to count
and display the total number of times a character is present.
10 Write a program to input elements in a tuple and to count and
display number of even and odd numbers present in it using
function.
11 Write a program to pass a dictionary to a function with list of
elements as keys and frequency of its occurrence as value and
return as a dictionary.
12 Write a program to read all lines from the file into list.
13 Write a program to copy the contents of a file to another file.
14 A text file named “test_report.txt” exists on a disk with the
following content [lines].
Write a function capitalize_Sentence() to create a copy of file
"test_report.txt" named as "file1.txt", which should convert the
first letter of the file and the first alphabetic character following a
full stop into upper case.
15 Write a program to store and display multiple integers in and from
a binary file.
i. Display the sum of all loan amounts whose interest rate is greater than 10.
ii. Display the maximum interest from loans table.
iii. Display the count of all loan holders whose name ends with ‘Sharma’.
iv. Display the count of all loan holders whose interest rate is Null.
v. Display the interest-wise details of loan account holders.
vi. Display the interest-wise details of loan account holders with at least 10 instalments
remaining
i)
ii)
iii)
iv)
v)
vi)
QUES-22: Consider the following tables Product and Client. Write SQL commands for the
statements (i) to (iii) and give outputs for SQL queries (iv) to (vi).
i. To display the details of those clients whose city is Delhi.
ii. To display the details of products whose price is in range of 50 to 100(both values
included).
iii. To display the details of those products whose name ends with ‘Wash’.
iv. SELECT DISTINCT CITY FROM CLIENT;
v. SELECT MANUFACTURER, MAX(PRICE),MIN(PRICE), COUNT (*) FROM
PRODUCT GROUP BY MANUFACTURER;
vi. SELECT PRODUCT NAME, PRICE*4 FROM PRODUCT;
i)
ii)
iii)
iv)
v)
vi)
QUES-23: Consider the following two tables: PRODUCT and CLIENT
NOTE: in product P_ID is primary key. In client C_ID is primary key and P_ID is the
foreign key referencing P_ID of client table. Write SQL commands for the queries (i) to
(iv) and output for (v) and (vi):
i. To display the client name and city of all Mumbai and Delhi based clients in client
table.
ii. Increase the price of all products in product table by 10%.
iii. To display the product name, manufacturer, expiry date of all the products that
expired on or before ‘2010-12-31’.
iv. To display C_ID, client name, city of all the clients (including the ones who have not
purchased a product) and their corresponding product name sold.
v. SELECT COUNT(DISTINCT MANUFACTURER)FROM PRODUCT;
vi. SELECT C_ID, CLIENT_NAME, CITY FROM CLIENT WHERE CITY LIKE
‘M%’;
i)
ii)
iii)
iv)
v)
vi)
QUES-24: Consider the following two tables: stationary and consumer.
NOTE: in stationary S_ID is primary key. In consumer C_ID is the primary key and P_ID
is the foreign key referencing S_ID of stationary table.
Write SQL commands for the queries (i) to (iv) and output for (v) to (vi):
i. To display details of all the stationary items in the stationary table in descending
order of stock date.
ii. To display details of that stationary item whose company is xyz and price is below
10.
iii. To display consumer name, address from the table consumer and company and
price from stationary table, with their corresponding S_ID.
iv. To increase the price of all the stationary table by rupees2.
v. SELECT COUNT(DISTINCT ADDRESS) FROM CONSUMER;
vi. SELECT STATIONARY_NAME, PRICE*3 FROM STATIONARY WHERE
COMPANY=’CAM’;
i)
ii)
iii)
iv)
v)
vi)
QUES-25: Consider the table employee and salgrade and answer (a) and (b) parts of the
question:
a)i)
ii)
iii)
iv)
b)i)
ii)
iii)
QUES-26: Write a Python programme to implement all basic operations of a stack, such as
adding element(PUSH operation), removing element (POP operation) and displaying the
stack elements(TRAVERSAL operation)using list:
QUES-27: Write a programme to display unique vowels present in the given word using
stack.
QUES-28: Write a program to create a stack called Employee, to perform the basic
operations on stack using list. The list contains the two values-employee number and
employee name. The program should include the options for addition, deletion and display
of employee details.