PRACTICALFILE - CS Ns
PRACTICALFILE - CS Ns
Roll No: 23 of Class XII , SESSION: 2023-2024 has prepared the Practical
file as per the prescribed Practical syllabus.
COMPUTER SCIENCE(083)
SIGNATURE OF TEACHER
NIDHI SINGH/12620/XII-B
INDEX
S.NO. PROGRAM SIGN.
01. Write a program that accepts a string as a parameter
to a function and counts the number of upper case
letters and lower case letters.
02. Write a Python program to find the factorial of a
number using default parameters. (Include proper
error condition for a negative number as input.)
11. Create a binary file GIFT having GiftID, gift name, remarks and price
and display details of those gifts, which has remarks as “ÖN
DISCOUNT”.
12 Write a Python script to read a VEHICLE.CSV file containing
Vehicle_Id, VehicleName, ManufatureYear having a comma as a
delimiter. Display those records where the voter age is more than 65.
Display any number of records from the bottom.
13. Create a CSV file by entering user-id and password, read and search for
the password for the given user-id.
NIDHI SINGH/12620/XII-B
14. Write a program to count the number of records present in
“customers.csv” file.
15. Write a Python menu-based program to implement a stack using the list.
1. Push 2. Pop 3. Peek 4. Show Stack 5.Exit
NIDHI SINGH/12620/XII-B
Q10. Write a Python script to create a dictionary with player's
name and their scores. Write a function that accepts this
dictionary as an argument and displays the name of the player
with the highest score.
INPUT:
OUTPUT:
NIDHI SINGH/12620/XII-B
Q11. Create a binary file GIFT having GiftID, gift name, remarks and
price and display details of those gifts, which has remarks as “ÖN
DISCOUNT”
INPUT:
OUTPUT:
NIDHI SINGH/12620/XII-B
Q12. Write a Python script to read a VEHICLE.CSV file containing
Vehicle_Id, VehicleName, ManufatureYear having a comma as a
delimiter. Display those records where the voter age is more
than 65. Display any number of records from the bottom.
INPUT:
OUTPUT:
NIDHI SINGH/12620/XII-B
Q13. Create a CSV file by entering user-id and password, read
INPUT:
NIDHI SINGH/12620/XII-B
OUTPUT:
INPUT:
OUTPUT:
NIDHI SINGH/12620/XII-B
Q15 Write a Python menu-based program to implement a stack
using the list.
INPUT
OUTPUT:
NIDHI SINGH/12620/XII-B
Q16 Write a random number generator that generates random
numbers between 1 and 6 (simulates a dice).
INPUT
OUTPUT
NIDHI SINGH/12620/XII-B
Q17 Write a menu-driven Python program to implement a stack
storing employee number, name and basic using a list data-
structure.
INPUT
OUTPUT
NIDHI SINGH/12620/XII-B
Q18. Create the following table and write the MySQL queries for the given
statements:
(a) To show all information of students where capacity is more than the no of
student in order of rtno.
(b) To show area_covered for buses more than 20 km., but charges less than
80000.
(c) To show rtno, area_covered and average cost per student for all routes where
average cost
per student is charges/noofstudents.
(d) To show the number of areas covered by all the bus routes.
(e) To show the number of area covered by each transporter.
(f) To show transporter wise total number of students traveling.
(g) Give the output considering the original relation as given :
i. select distinct transporter from schoolbus ;
ii. select count(distinct transporter) from schoolbus ;
iii. select transporter, max(charges) from schoolbus group by transporter;
NIDHI SINGH/12620/XII-B
(a)
(b)
(c)
NIDHI SINGH/12620/XII-B
(d)
(e)
(f)
NIDHI SINGH/12620/XII-B
(g)(i)
(g)(ii)
(g)(iii)
NIDHI SINGH/12620/XII-B
Q19. Consider the two tables EMPLOYEE and DEPT with proper primary key &
foreign key.
(a) Show the minimum, maximum and average salary of Managers.
(b) Display the designation wise list of employees with name, Sal and date of
joining.
(c) Count the number of Clerks in an organization.
(d) Count the number of employees who are not getting commission.
(e) Show the average salary for all departments with more than or equal to 2
working people.
(f) List the count of employees grouped by deptno.
(g) Display the name of employees who has name starting with “A”.
(h) Display the name of employees working in the same city where they belong.
(i) Display the name of employees who is managing sales department.
(j) Display the name who are working in Delhi and getting more than 5000
(k) Delete the record of the employee whose designation is operator
(l) Delete the column join date from the table employee.
NIDHI SINGH/12620/XII-B
(a)
(b)
(c)
(d)
NIDHI SINGH/12620/XII-B
(e)
(f)
(g)
NIDHI SINGH/12620/XII-B
(h)
(i)
(j)
NIDHI SINGH/12620/XII-B
(k)
(l)
NIDHI SINGH/12620/XII-B
Q20 . Create the following table PRODUCT and CLIENT, with proper primary key &
foreign key and answer the questions given below.
(a) To display the details of those clients whose city is “Delhi”.
(b) To display the details of products whose price is in the range of 50 to 100.
(c) To display the client name , city from table client and product name and price
from the table product with their corresponding matching p_id.
(d) To increase the price of the product by 10.
(e) Add a new column country to the table product.
(a)
(b)
(c)
NIDHI SINGH/12620/XII-B
(d)
(e)
NIDHI SINGH/12620/XII-B
Q21. Create the following table Tech_Courses and give the output of the queries
given:
(i) SELECT COUNT(DISTINCT(TID)) FROM TECH_COURSE;
(ii) SELECT TID, COUNT(*), MIN(FEES) FROM TECH_COURSE GROUP BY TID
HAVING COUNT(TID)>1;
(iii) SELECT CNAME FROM TECH_COURSE WHERE FEES>15000 ORDER BY
CNAME;
(iv) SELECT AVG(FEES) FROM TECH_COURSE WHERE FEES BETWEEN 15000
AND 17000;
(i)
(ii)
(iii)
(iv)
NIDHI SINGH/12620/XII-B
Q22.Integrate MySQL with Python by importing a suitable
module and then create the table product with the following
details product no,product name,price,purchase date,quantity ,
add five records in the table, and then retrieve all the records
in proper format in Python.
INPUT
NIDHI SINGH/12620/XII-B
OUTPUT
NIDHI SINGH/12620/XII-B
Q23 Perform a delete query on the table products to delete the product
having price greater than 100 using Python MySQL connectivity
INPUT
OUTPUT
NIDHI SINGH/12620/XII-B
Q24 Write a program to connect with database employee and table
emp with following fields empno,empname ,dept,salary and store
record of an employee and then display it based on employee number
entered by the user.
INPUT
NIDHI SINGH/12620/XII-B
NIDHI SINGH/12620/XII-B
OUTPUT
NIDHI SINGH/12620/XII-B
Q25.Write a program to connect with database employee and
then update the department and salary (as per user
requirements) after accepting employee number from the user.
INPUT
NIDHI SINGH/12620/XII-B
OUTPUT
NIDHI SINGH/12620/XII-B