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

Class XII CS Practical File Programs 2022-23

This document contains an index of Python programs to be completed for a class on Practical File Programs for Class XII-CS. The programs cover topics like writing user-defined functions (UDFs) to check if a number is prime, count characters in a string, perform binary search on a list, count words in a text file, read and display lines from a text file based on starting characters, count occurrences of characters in a text file, count lines ending with vowels in a text file, copy words from one file to another, search for a book number in a binary file, perform dictionary operations on a binary student file, implement stack operations using lists, and connect to a MySQL database to perform CRUD operations on

Uploaded by

Ashmit S
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views

Class XII CS Practical File Programs 2022-23

This document contains an index of Python programs to be completed for a class on Practical File Programs for Class XII-CS. The programs cover topics like writing user-defined functions (UDFs) to check if a number is prime, count characters in a string, perform binary search on a list, count words in a text file, read and display lines from a text file based on starting characters, count occurrences of characters in a text file, count lines ending with vowels in a text file, copy words from one file to another, search for a book number in a binary file, perform dictionary operations on a binary student file, implement stack operations using lists, and connect to a MySQL database to perform CRUD operations on

Uploaded by

Ashmit S
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Practical File Programs -2022-23

Class XII-CS (083)


INDEX
SECTION – A ( PYTHON )
S.N DATE OF
PROGRAM SIGN
O SUBMISSION
Write a UDF in Python , it will take a number as a function

1. argument . Function check and display given number if


prime or not.
Write a UDF in python , it will take a string as a function
argument. Function count and display the number of
2.
vowels, consonants , uppercase, lowercase characters in
string.
Write a UDF in python, it will take two arguments
list(sequence of elements) and finding element . Function
3.
search and return 1 if element is present in the given list
otherwise return -1 . Using Binary search.
Write a function in PYTHON that counts the number of “Me”
4.
or “My” words present in a text file “DIARY.TXT”.
Write a function in PYTHON to read the contents of a text

5. file “Places.Txt” and display all those lines on screen which


are either starting with ‘P’ or with ‘S’.
Write a function EUCount() in PYTHON, which should read
each character of a text file IMP.TXT, should count and
6.
display the occurrences of alphabets E and U (including
small cases e and u too).
Write a function in PYTHON to count the number of lines
7.
ending with a vowel from a text file “STORY.TXT’.
Write a function copy() that will copy all the words starting

8. with an uppercase alphabet from an existing file


“FAIPS.TXT” to a new file “DPS.TXT”.
Write a function in PYTHON to search for a BookNo from
a binary file “BOOK.DAT”, assuming the binary file is
9.
containing the records of the following type: ("BookNo",
"Book_name"). Assume that BookNo is an integer.
Write a menu-driven program to perform all the basic
operations using dictionary on student binary file such as
10.
inserting, reading, updating, searching and deleting a
record.
11. Write a function in PYTHON to search for a BookNo from a
binary file “BOOK.DAT”, assuming the binary file is
containing the records of the following type: {"BookNo":value,
"Book_name":value}. Assume that BookNo is an integer.
Write a menu-driven program implementing user-defined
functions to perform different functions on a csv file
“student” such as:
12.
(a) Write a single record to csv.
(b) Write all the records in one single go onto the csv.
(c) Display the contents of the csv file.
Create a CSV file by entering user-id and password, read
13.
and search the password for given userid.
Write a function in Python for PushS(List) and for PopS(List)

14. for performing Push and Pop operations with a stack of List
containing integers.
Write a program to create a stack called student, to perform
the basic operations on stack using list. The list contains
two data values called roll number and name of
student. Notice that the data manipulation operations are
performed as per the rules of a stack. Write the
15.
following functions :
• PUSH ( ) - To push the data values (roll no. and
name) into the stack.
• POP() - To remove the data values from the stack.
• SHOW() - To display the data values from the stack.
ABC Infotech Pvt. Ltd. needs to store, retrieve and delete
the records of its employees. Develop an interface that
provides front-end interaction through Python, and stores
and updates records using MySQL.
(a) Write a UDF to create a table ‘EMPLOYEE’ through
MySQL- Python Connectivity.
(b) Write a UDF to add/insert employee data into the
‘EMPLOYEE’ table through MySQL-Python

16. Connectivity.
(c) Write a UDF to fetch and display all the records from
EMPLOYEE table .
(d) Write a UDF to update the records of employees by
increasing salary by 1000 of all those employees who
are getting less than 80000.
(e) Write a UDF to delete the record on the basis of
Employee eno.
Write a menu driven program to perform all operations.
SECTION –B (SQL)

Q1. Consider the tables EMPLOYEE and SALGRADE given below and answer (a) and
(b)parts of this question.

(a) Write SQL commands for the following statements:


(i) To display the details of all EMPLOYEEs in descending order of DOJ.
(ii) To display NAME and DESIG of those EMPLOYEEs whose SALGRADE is either S02
or S03.
(iii) To display the content of the entire EMPLOYEEs table, whose DOJ is in between
‘09-Feb-2006’ and ‘08-Aug-2009’.
(iv) To add a new row with the following content:
109,‘Harish Roy’,‘HEAD-IT’,‘S02’,‘9-Sep-2007’,‘21-Apr-1983’
(b) Give the output of the following SQL queries:
(i) SELECT COUNT(SGRADE),SGRADE FROM EMPLOYEE GROUP BY SGRADE;
(ii) SELECT MIN(DOB),MAX(DOJ) FROM EMPLOYEE;
(iii) SELECT SGRADE, SALARY+HRA FROM SALGRADE WHERE SGRADE =’S02’;
Q2. Study the following table and write SQL queries for questions (i) to (iv) and output for
(v) and (vi).

(i) Write SQL query to display Pname, Quantity and Rate for all the orders that are either
Pencil or Pen.
(ii) Write SQL query to display the orders which are not getting any Discount.
(iii) Write SQL query to display the Pname, Quantity and Sale_date for all the orders
whose total cost (Quantity * Rate) is greater than 500.
(iv) Write SQL query to display the orders whose Rate is in the range 20 to 100.
(v) SELECT Pname, Quantity from Orders WHERE Pname LIKE(‘_e%’);
(vi) SELECT Pname, Quantity, Rate FROM Orders Order BY Quantity DESC;
Q3. Write SQL commands for (i) to (vi) on the basis of relations given below:

(i) To show the books of FIRST PUBL. Publishers written by P. Purohit.


(ii) To display cost of all the books published for FIRST PUBL.
(iii) Depreciate the price of all books of EPB publishers by 5%.
(iv) To display the BOOK_NAME and price of the books, more than 3 copies of which have
been issued.
(v) To show total cost of books of each type.
(vi) To show the details of the costliest book.
Q4. Consider the given table and answer the questions.

(i) To show all information of students where capacity is more than the no. of students in
order of rtno.
(ii) To show area_covered for buses covering more than 20 km., but charges less than
80000.
(iii) To show transporter-wise total no. of students travelling.
(iv) To show rtno, area_covered and average cost per student for all routes where average
cost per student is—charges/noofstudents.
(v) Add a new record with the following data:
(11, “Motibagh”,35,32,10, “kisan tours”, 35000)
(vi) Give the output considering the original relation as given:
(a) select sum(distance) from schoolbus where transporter= “Yadav travels”;
(b) select min(noofstudents) from schoolbus;
(c) select avg(charges) from schoolbus where transporter= “Anand travels”;
(d) select distinct transporter from schoolbus;
Q5. Given the following tables for a database FURNITURE and ARRIVALS.
Table: FURNITURE
NO ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1 White lotus Double Bed 23/02/02 30000 25
2 Pink teather Baby cot 20/01/02 7000 20
3 Dolphin Baby cot 19/02/02 9500 20
4 Decent Office Table 01/01/02 25000 30
5 Comfort zone Double Bed 12/01/02 25000 25
6 Donald Baby cot 24/02/02 6500 15
7 Royal Finish Office Table 20/02/02 18000 30
8 Royal tiger Sofa 22/02/02 31000 30
9 Econo sitting Sofa 13/12/01 9500 25
10 Eating Paradise Dining Table 19/02/02 11500 25
Table : ARRIVALS

NO ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT

11 Wood Comfort Double Bed 23/03/03 25000 25

12 Old Fox Sofa 20/02/03 17000 20

13 Micky Baby cot 21/02/03 7500 15

Write SQL commands for the statements (a) to (d)

(a) To list the ITEMNAME which are priced at more than 15000 from the
FURNITURE table.
(b) To list ITEMNAME and TYPE of those items, in which DATEOFSTOCK is
before
22/01/02 from the FURNITURE table in descending order of ITEMNAME.
(c) To display ITEMNAME and DATEOFSTOCK of those items, in which the DIS-
COUNT
percentage is less than 25 from FURNITURE table.
(d) To count the number of items, whose TYPE is ‘Sofa’ from FURNITURE table.

You might also like