0% found this document useful (0 votes)
82 views7 pages

12 CS Practical File 2023-24

Uploaded by

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

12 CS Practical File 2023-24

Uploaded by

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

DPS RUBY PARK, KOLKATA

CLASS XII COMPUTER SCIENCE BOARD PRACTICAL FILE


Submission Deadline: 15th NOVEMBER, 2023
If you submit any time after the deadline, you will not receive full credit
points

PROGRMS ON TEXT FILES:

1. Write a function to open the text file ABC.txt and count the number of wordsthat start
with ‘the’, like the, their, they, them, these etc.

2. Write a Python program to count all lines in the file ABC.txt having ‘a’ as thelast
character.

3. Write a Python program to count the number of digits in the text file DIGIT.txt.

4. Write a function to transfer all lines starting with a vowel from ORIGIN.txt toNEW.txt.

5. Write a Function to read data from a text file DATA.TXT, and display those words, which
are less than 4 characters.

PROGRMS ON BINARY FILES:

6. Write a function to add (append) Employee records (Empno, name and address
,salary)onto a Binary file.

7. Write a function to Delete a Student record (Rollno, name, class, section, mobileno,
marks) in a binary file named Student.dat. Record will be deleted based on Rollno
passedas parameter to the function.
8. Write a function to Update marks of a Student record (Rollno, name, marks)in a binary
file named Student.dat. Record will be updated based on Rollno passed as parameter to the
function.

PROGRMS ON CSV FILES:

Create a CSV file patient.csv and write the following program.

9. Write a program to display the record of those patients whose cholesterol is more
than 250 and Resting BP is less than 125 from a file the “patient.csv”.

10. Write a program to display the Blood sugar of those patient whose name either starting
with ‘O’ or ending with ‘r’ and Age is more than 70 from file the “patient.csv”.

11. Write a program to display the content of row in reverse order from the file
“patient.csv”.
PROGRMS ON LIST, STRING & DICTIONARY USING FUNCTION:

12. Write a program using function to input a string (word). Convert it into lowercase
letters. Count and print the frequency of each alphabet present in thestring. The output
should be given as:

Sample Input: Alphabets


Sample Output:
==========================
Alphabet Frequency
==========================
a 2
b 1
e 1
h 1
l 1
p 1
s 1
13. Write a program using function to input a list of elements and display a listwith only
duplicate elements after removing the unique ones.

Output :
The original list : [10, 20, 30, 10, 40, 20, 50]
The Duplicate list : [10, 20]

14. Write a program to input a string and display it in the descending order ofalphabets
using bubble sorting technique.

Sample Input: cattle


Sample Output: ttttleca

15. Write a program to input two dictionary and then subtract the values of twodictionary.
Output :
The original dictionary 1 : {'gfg': 6, 'is': 4, 'best': 7}
The original dictionary 2 : {'gfg': 10, 'is': 6, 'best': 10}The
Difference dictionary is : {'gfg': 4, 'is': 2, 'best': 3}

PROGRMS ON PYTHON-MYSQL INTERFACE:

16. Write a Program to connect with database and store record in employee table
(empno,empname, department, salary) and display entire records.

17. Write a Program to connect with database and search a record from employee
table(empno, empname, department, salary) based on empno and display records.

18. Write a Program to connect with database and update a record from employee table
(empno, empname, department, salary) based on empno and display records.

19. Write a Program to connect with database and delete a record from employee
table(empno, empname, department, salary) based on empno and display records.
QUERY ON MYSQL:

20. Consider the following table Prepaid and answer the below-given questions:

CustoID Custname Model Connection Plan

C0001 Sagar Xiomi Vodafone 399

C0002 Priya Oppo Jio 149

C0003 Milan Vivo Vodafone 699

C0004 Kaushik Redmi Airtel 250

C0005 Karthik Vivo Jio 79

Write queries for the following:

(I) To display customer details who are using Jio and vodafone.
(II) To display unique connection from the table.
(III) To display maximum plan amount for each connection.
(IV) To display the count of each model type.
(V) To display customer details whose names end with ‘k’.

21. Consider the following table stock table to answer the queries:

itemno item dcode qty unitprice stockdate

S005 Ballpen 102 100 10 2018/04/22

S003 Gel Pen 101 150 15 2018/03/18

S002 Pencil 102 125 5 2018/02/25

S006 Eraser 101 200 3 2018/01/12

S001 Sharpner 103 210 5 2018/06/11

S004 Compass 102 60 35 2018/05/10

S009 A4 Papers 102 160 5 2018/07/17


(I) Display all the items in the ascending order of stockdate.
(II) Display maximum price of items for each dealer individually as per dcode from stock.
(III) Display all the items in descending orders of item names.
(IV) Display average price of items for each dealer individually as per dcode from stoc
whoseaverage price is more than 5.

(V) Display the sum of quantity for each dcode.

22. Create a table Club in the database Sports by using the following constraints and execute
the following queries:

Coach_Id to be set as primary key.


Check PAY should not be less than 30000.
Coach name should be NOT NULL.

Coach_Id Coach_Name Age Sports Pay


1 TARUN 35 BASKETBALL 500
2 ANIRUDDH 34 SWIMMING 600
3 ANIMESH 32 SQUASH 900
4 ANIL 35 SWIMMING 500
5 SUMIT 33 KARATE 700

(a) Display the names of those coaches whose name start with the letter “A” and ends with
“H”.
(b) Display the sum of Pay of the Swimming coaches
(c) Display the name of the coaches and their age in descending order of age.
(d) Increase the pay of all the coaches by 10%.
(e) Remove Primary key constraint from Coach_Id and add Coach_Name as primary key.
(f) Delete the records of the coaches of Swimming.
(g) Add a new column Gender in the table “Club”

23. Create a table “Product” in the database “Stock” by using the following constraints and
execute the following queries:

PID should be set as primary key.


Check Total price should not be more than 100000.
PID PRODUCT NUMBER_OF_ITEMS TOTAL_PRICE
P01 CURTAIN 43 52200
P02 BEDSHEET 92 32700
P03 REFRIGERATOR 100 21500
COVER
P04 PILLOW PACK 20 2430
P05 WASHING 34 2210
MACHINE
COVER
(h) Display the names of those products whose name ends with the letter “R”.
(i) Display those products which are available in stock less than 50.
(j) Display the products and their total price in descending order of their total price.
(k) Remove Primary key constraint from PID and add product name as primary key.
(l) Increase the number of items of all the products by 10%.
(m) Delete the records of those products where total price is less than 5000.
(n) Add a new column Date_of_manufacture in the table “Product”.

25. Consider the following tables PRODUCT and CLIENT. Write SQL commands for the following
statements (i) to (iv):

Table: PRODUCT
PID ProductName Manufacturer Price

TP01 Talcum Powder LAK 40

FW05 Face Wash ABC 45

BS01 Bath Soap ABC 55

SH06 Shampoo XYZ 120

FW12 Face Wash XYZ 95

Table: CLIENT
CID ClientName City PID

01 Cosmetic Shop Delhi FW05

06 Total Health Mumbai BS01

12 Live Life Delhi SH06

15 Pretty Woman Delhi FW12

16 Dreams Bangalore TP01

(a) To display the details of those clients whose City is Delhi in alphabetical order of client name.
(b) To display the average price of all products, manufacturer wise.
(c) To display the Product Name and Client Name of clients whose manufacturer is ‘ABC’.
(d) To increase the Price of all Products by 100.

You might also like