Cs Practical File
Cs Practical File
NAME-KSHITIZ SRIVASTA
School name-GAUR
INTERNATIONAL SCHOOL
Class: 12 B1
QUES1: Create a menu driven program using functions with the following options: - To check
if a string is a palindrome. - To toggle a string (without using swapcase) - Count number of
occurrences of a digit, special characters - To take a string and create a list of words from the
string starts with a vowel.
2. Create a menu based program with following list related functions. Accept list in the main
area and pass it as an argument. - Left shift each element. - Right shift each element -
Reverse a list. - Interchange first half elements with second half. - Swap adjacent elements in
a list.
3. Create a Menu based program by passing arguments to the functions for the following -
Calculate factorial of a numbers between 2 and 8. - Generate prime numbers between two
numbers. - Print sum series: x 1 /2! – x 3 /4! + x 5 /6! - x 7 /8! + …… Upto n termsj
4. Menu based program to create a dictionary which takes a decimal number as key and asks
the user to which number system it should be converted based on the input the value is
created. {10:[‘Binary’,1010],11:[‘Hexadecimal’,’B’],13:[‘Octal’:15]}
5. Write a program to get the name, marks of the students of a class from the user and store
these details in a file
6. Program to display the size of the file after removing EOL characters, leading and trailing
white spaces
7. Write a program in python to do the following related to text files - To count the number of
vowels in the file. - Read the text file count number of char, words, lines
8. Read text file and do the following - count number of words starting with ‘A' -
count words with length>10 - count how many times word ‘the’ is present in the file
9. Read text file and do the following - Count the number of lines starting with 'T'. - Count
number of lines containing word 'is'
10.Remove all the lines from the file that contain the character 'Z' from file 'Para.txt' and
write it to another file.
11.Create a Binary file Student.dat with information roll no, name and marks. Write
functions to do the following: a) Add records (one record at a time) b) Display all records. c)
Display records of students having marks>90
12. Write functions to do the following in Student.dat a) Update marks of a specific student.
Search on rollno. b) Delete record of a specific student. c) Display all records.
13. Create a Binary file Book.dat (Bookno, Name, Subject, Price). Write functions to
do the following: a) Add records through a nested list of
[Bookno,Name,Subject,Price] b) Display all records
14. Write functions to do the following in Book.dat a) Update Price of a particular
Book. b) Show all Books with Price>500
15. Create a Binary file item.dat with a dictionary containing itno, name and price. Write
Functions to add, display, search(itno) and update(price) records.
16. CSV files- create a file and read a csv file. – school bus file
17 Create a menu driven program to perform Push, Pop, Peek and Display the contents of
stack containing numbers.
18 Create a stack for the book details(bookno,bookname). That is. Now each item node of
the stack contains two types of information – bookno, name. Write Push and Pop operations
for the same.
20. Create a table Client with following structure: C_ID integer (Primary Key), Client Name
varchar (15), City varchar (10), P_ID char (4) Write queries to do the following: a. Add 5
records to it b. To display C_ID, ClientName, City and ProductNamefor all Clients residing in
Delhi. c. To add a field Balance Numeric (8,2) with a default value 12000. d. To show C_ID,
ClientName and Monthly Balance(Balance/12). Using aliasing for Monthly balance. e. To
show records of all clients with ClientName consisting of 4 characters. f. Delete all records of
clients with City=’Bengaluru.
19. Create a table Product with following structure: P_ID CHAR (4) PRIMARY KEY,
PRODUCTNAME VARCHAR (12), MANUFACTURER CHAR (3), PRICE INTEGER, EXPIRYDATE
DATE. Write queries to do the following: a. Add any 5 records to it. b. To display Product
name, Manufacturer, Expirydate for all products that expired on or before ‘2010-12-31’. c.
To display all records with Manufacturer starting with ‘L’. d. To display all records in
descending order of price. e. To display the number of unique Productname. f. To display
average price, minimum price, maximum price and count Productname wise. (Hint: Use
Group by). g. Increase price of products by 10% .
21. Create the following tables ACTIVITY and COACH. Write SQL commands for the
statements (i) to (v) Table: ACTIVITY and Coach i) To display the name of all activities with
their ACode in descending order. ii) To display sum of PrizeMoney for each of the Number of
participants’ groupings (as shown in column ParticipantsNum 10,12,16) iii) To display the
coach’s name, Activity name and ACode from the table COACH and ACTIVITY iv) To display
the content of the Activity table whose ScheduleDate earlier than 01/01/2004 in ascending
order of ParticipantsNum. v) To display Maximum ScheduleDate and Minimum
ScheduleDate from table Activity.