0% found this document useful (0 votes)
48 views

LIST OF PRACTICALS CS CLASS XII CS

Uploaded by

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

LIST OF PRACTICALS CS CLASS XII CS

Uploaded by

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

LIST OF PRACTICALS

SUB: COMPUTER SCIENCE (083)


SESSION 2024-25
CLASS XII CS

1 Write a menu driven program using functions in python to check a number


- prime or not.
- palindrome or not
- factorial of number

2 Write a python program using function named largest(a,b,c) which will accept 3 numbers
as parameters and return the largest one. Use the concept of KEYWORD parameters.
3 Write a program to calculate compound interest using function named
compint(P,r,n,t) ,where the default value of rate( r) is 10.

4 Write a program using function to print Fibonacci series upto n terms. Give default value
of n as 15.

5 Write a program to generate 10 random numbers between 1 to 100.


6 Write a program to generate the following series-

7 Write a program to enter a list and find the largest and smallest element in the list.
8 Write a program to enter a list and replace the even elements by their square and odd by
their cube.
9 Write a program to enter a tuple and find the sum and average of all the elements.
10 Write a program to create a dictionary having names of your friends as keys and their
phone number as values.
11 Write a python program to read and display text file content with each word separated
by #.
12 Write a python program to copy all the lines that contain the character ‘a’ in a text file
“file1.txt” to another file “file2.txt”.

13 Write a menu driven program using functions to find the following in text file “story.txt”
● Upper case letters
● Lower case letters
● Digits
● Spaces
● vowels
14 Write a menu driven program using functions to count following in text file “story.txt”
●Total words
●Words having length 5
●“hello”
15 Write a menu driven program to find the following in text file “story.txt”
● To count lines starting with ‘P’ or ‘T’
● To count lines starting with vowels

16 Write a python program to create a binary file with roll number, name and address.
Search for a given roll number and display name and address , if not found display
appropriate message.
17 Write a python program to create a binary file with roll number, name and marks, input a
roll number and update the marks.
18 A binary file “Book.dat” has structure [BookNo, Book_Name, Author, Price].
i. Write a user defined function CreateFile() to input data for a record and add to
Book.dat .
ii.Write a function CountRec(Author) in Python which accepts the Author name as parameter
and count and return number of books by the given Author are stored in the binary file
“Book.dat”

19 . A binary file “STUDENT.DAT” has structure (admission_number, Name, Percentage). Write a


function countrec() in Python that would read contents of the file “STUDENT.DAT” and display the
details of those students whose percentage is above 75. Also display number of students scoring above
75%

20. Write a python program to create a CSV file with empid, name and mobile no. and search
empid, update the record and display the records.

21. Program in Python to create a stack named ‘book’ which contains these book details :
(bookno, book name). That is, now each item node ofthe stack containstwo types of
information – a bookno and its name. Implement Push, Pop, and Traversal operations on the
stack.

22. Each node of a STACK contains the following information: (i) Pin code of a city, (ii) Name
of city. Write a program to implement following operations on abovestack.
(a.) PUSH( ) – To push a node into the stack.
(b.) POP( ) – To remove a node from the stack
23. Write a python program to create stack Sport_Stack to store age of sportsman using
stack implementation as list. Write Operation for Push, Pop and Traversal operation using
menu.
24. Create a CLUB table as mentioned with given data type and constraints. Table - CLUB
Field Name Data Type Data Limit Constraint

coach_id Int (3,0)

coachname Text 15 char NOT NULL

age Int (2,0)

sports Char 10

datofapp Date

pay Numeric (7,2) Pay > 0

sex Char 1 Default value ‘M’


and insert data as given below in this using suitable SQL statements.
COACH_ID COACHNAME AGE SPORTS DATOFAPP PAY SEX

1 KUKREJA 35 KARATE 27/03/1996 1000 M


2 RAVINA 34 KARATE 20/01/1998 1200 F
3 KARAN 34 SQUASH 19/02/1998 2000 M
4 TARUN 33 BASKETBALL 01/01/1998 1500 M
5 ZUBIN 36 SWIMMING 12/01/1998 750 M
6 KETAKI 36 SWIMMING 24/02/1998 800 F
7 ANKITA 39 SQUASH 20/02/1998 2200 F
8 ZAREEN 37 KARATE 22/02/1998 1100 F
9 KUSH 41 SWIMMING 13/01/1998 NULL M
10 SHAILYA 37 BASKETBALL 19/02/1998 1700 M

Write SQL commands for the following –


1.) Alter table to make coach_id as primary key.
2.) Change the size of coachname field to 20 characters.
3.) Add new column ‘participants_no’ having integer data type in table.
4.) Remove above added column.
5.) Make ‘swimming’ as default value for sports.
6.) To display number of records in a table.
7.) To display sports name distinctly.
8.) To show all the information about the swimming coaches in the club .
9.) To list names of all coaches with their date of appointment (DATOFAPP) in
descending order.
10.) To display number of coaches in each sports.
11.) To display number of coaches who are being paid.
12.) To display a report , showing coachname , pay, age and bonus (15% of
pay) for all the coaches.[ the name of the field 15% of pay should be ‘Bonus’ ]
13.) To display total no. of male and female coaches individually.
14.) To display detail of the coach who appointed first.
15.) To display coachname in which name contains 2nd character as ‘A’.
16.) To print details of the coaches who are appointed in the month of
February 1998. 17.) To display average payment of all coaches.
18.) To display detail of the coaches whose age lies between 30 to 35.
19.) Update name of the coach as ‘KUSHA’ having coach id is 9.
20.) Remove the details of all coaches playing ‘karate’ and pay is 1000 or below.

25. In a database there are two tables “Product” and “Client” as shown
below : Table – Product
P_ID Product_Name Manufacture Price

P001 Moisturiser XYZ 40


P002 Sanitizer LAC 35
P003 Bath Soap COP 25
P004 Shampoo TAP 95
P005 Lens Solution COP 350
Table – Client
C_ID ClientName City P_ID

01 Dreamz Disney New Delhi P002


05 Life Line Inc Mumbai P005
12 98.4 New Delhi P001
15 Appolo Banglore P003
Write the commands in SQL queries for the following:
1.) To display the details of product whose price is in range of 40 and 120
( both values included).

2.) To display the client name , city from table client and product name and price
from table product , with their corresponding matching P_ID.
3.) To increase the price of all the products by 20.
4.) To display product details where client belongs to ‘New Delhi’.
5.) To list all the products who do not have any client in ‘New Delhi’ and
‘Mumbai’ .
6.) To display number of clients in each city.
7.) To list all the clients having product price maximum rs. 50.
8.) To display product name and its price with decreasing order
of price.
9.) To display total no. of products.
10.) Show the average price for all products.

26. Write a menu-driven program which integrates MySQL and Python connectivity
with the table BOOKS whose content is given below. Create the database named
LIBRARY. Database Name- LIBRARY
Table Name- BOOKS
Make Book_id as the primary key.

Write the following functions for the same


a) Adding record
b) Deleting record
c) Updating record
d) Searching record
e) Showing all data

You might also like