You are on page 1of 9

CERTIFICATE

This is to certify that Amitoj Singh, CBSE Roll


No.__________ student of class XII-A,
Maxfort School, Rohini has successfully
completed the Practical Work in the subject
Computer Science (083) for the purpose of
Practical Examination in Class XII.

Internal Examiner’s Signature: ____________

External Examiner’s Signature: ___________

Principal’s Signature: _______________


ACKNOWLEDGEMENT
I would like to express my deep sense of
gratitude to the luminary Principal Dr.
Ratna Chakravarty, Maxfort School Rohini
who has been continuously motivating us.
She provided us with invaluable advice
and helped us in difficult periods. Her
motivation and help contributed
tremendously to successful completion of
this file work.
My sincere thanks to Ms. Pinky Gupta,
teacher in-charge, a guide and a mentor
who critically reviewed my practical file
and helped in solving each and every
problem, occurred during its
implementation.
INDEX
S.No. Program Name Date Signature
BASIC PYTHON PROGRAMS
1 Write a program to find if the given string is palindrome or not.
2 Write a program to create a phone contact book and also to
search, update and delete contact.
3 Write program to find area of the shapes using module.
4 Write a program that generates random numbers of dice
between 1 to 6.
FUNCTIONS AND FILE HANDLING
1 Write a program by using user defined function in Python that
counts the number of “Me” or “My” (in smaller case also)
words present in a text file “STORY.TXT”.
2 Write a program by using user defined function AMCount()
Python which should read each character of a text file
“STORY.TXT”,should count and display occurrence of
alphabets ”A” and “M”.
3 Write a program by using user defined function to count
number of lines in text file “STORY.TXT” which are starting
from alphabet “A”.
4 Write a program by using user defined function
DISPLAYWORDS() in Python to read lines from a text file
“STORY.TXT”, and display those words, which are less than 4
characters.
5 Write a program by using user defined function RevText() to
read a text file “STORY.TXT” and print only words starting from
“I” in reverse order.
6 Write a program by using user defined function to count the
number of lower case alphabets present in a text file
“STORY.TXT”.
7 Write a program by using user defined function named count()
that will read the contents of text file named “STORY.TXT” and
count number of lines that starts with either “I” or “M”.
8 Write a program to read a text file line by line and display each
word separated by #.
9 A binary file “Book.dat” has structure
[BookNo,Book_Name,Author,Price]. Write a program by using
user defined function CreateFile() to input data for a record
and add to Book.dat.
10 Write a program by using user defined 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 binary file “Book.dat”.
11 A binary file “STUDENT.DAT” has structure
[admission_number,Name,Percentage]. Write a program by
using user defined 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%.
12 Write a program by using user defined function to search and
display details, whose destination is “Cochin” from binary file
“Bus.dat”. Assuming the binary file is containing following
elements in the list: Bus Number, Bus Starting Point, Bus
Destination.
13 Write a program by using user defined function addrec() in
Python to add more records at the binary file “STUDENT.DAT”
assuming the binary file is containing the following structure [
Roll Number, Student Name]
14 Write a program by using user defined function searchpod (pc)
in Python to display the record of particular product from file
product.dat whose code is passed as argument. Structure of
product contains following elements [ product code, product
price].
15 Write a program by using user defined function
routechange(routenumber) which takes route number as parameter
and modify route name of passed route number in binary file
“route.dat”.
16 Write a program by using user defined function
countrec(sportname) in Python which accepts name of sport as
parameter and count and display the coach name of sport which is
passed as argument from binary file “sport.dat”. Structure of record
in file is [sport name, coach name].
17 A binary file “salary.dat” has structure [employee id, employee
name, salary]. Write a program by using user defined function
countrec() in Python that would read contents of the file
“salary.dat” and display the details of those employees whose salary
is above 20000.
18 Amit is a monitor of class XII-A and he stored the record of all the
students of his class in a file named “class.dat”. Structure of record
is [roll number, name, percentage]. His computer teacher has
assigned following duty to Amit. Write a program by using user
defined function remcount() to count number of students who need
remedial class(students who scored less than 40 percent).
19 A binary file “emp.dat” has structure [employee number, employee
name]. Write a program by using user defined function
delrec(employeenumber) in Python that would read contents of the
file “emp.dat” and delete the details of those employee whose
employee number is passed as argument.
20 Write a program to store customer data into a binary file cust.dat
using a dictionary and print them on screen after reading them. The
customer data contains ID as key and name ,city as values.
21 Write a menu driven program as following 1. Insert record 2. Search
record 3. Update record 4. Display record 5. Exit Use cust.dat that
contains information as cust_id, cust_name, city.
22 Write a program to read entire data from file data.csv
23 Write a program to search the record from “data.csv” according to
admission number input from the user. Structure of record saved in
“data.csv” is Adm_no,Name,Class,Section,Marks.
24 Write a program to add/insert records in file “data.csv”. Structure
of a record is roll number,name,class.
25 Write a program to add/insert records in file “data.csv”. Structure of
a record is roll number,name,class.
26 Write a program to read all content of “student.csv” and display
records of only those students who scored more than 80 marks.
Records stored in students is in format : Rollno, Name, Marks
27 Write a program to display all the records from product.csv whose
price is more than 300. Format of record stored in product.csv is
product id, product name, price.
28 Write a program to calculate the sum of all the marks given in the
file “marks.csv”. Records in “marks.csv” are as follows : Rollno,
Name, Marks 1, Suman, 67 2, Aman,71 3, Mini, 68 4, Amit, 80
29 Write a program to count number of records present in “data.csv”
file.
30 Write a program to modify the record of a student in a file
“data.csv”. Following records are saved in file. Rollno, Name, Marks
1, Aman, 35 2, Kanak, 1 3, Anuj, 33 4, suman, 25
31 Write a program to show the detail of the student who scored the
highest marks. Data stored in “Data.csv” is given below : Rollno,
Name, Marks 1, Aman, 35 2, Kanak, 1 3, Anuj, 33 4, suman, 25
STACK USING LIST
1 Write a function push(student) and pop(student) to add a new
student name and remove a student name from a list student,
considering them to act as PUSH and POP operations of stack.
2 Write a function push(number) and pop(number) to add a
number (Accepted from the user) and remove a number from
a list of numbers, considering them act as PUSH and POP
operations.
3 Write a menu based program to add, delete and display the
record of hostel using list as stack data structure in python.
Record of hostel contains the fields : Hostel number, Total
Students and Total Rooms.
4 Write a function Push() which takes number as argument and
add in a stack "MyValue"
5 Write a function Push that takes "name" as argument and add
in a stack named "MyStack"
6 Write a function Push() which takes "name" as argument and
add in a stack named "MyStack". After calling push() three
times, a message should be displayed "Stack is Full"
7 Write a function pop() which remove name from stack named
"MyStack".
8 Write push(rollno) and pop() method in python: push(rollno) --
add roll number in Stack pop() --- remove roll number from
Stack.
9 Write add(bookname) and delete() method in python to add
bookname and remove bookname considering them to act as
push() and pop() operations in stack.
10 Write addclient(clientname) and remove() methods in python
to add new client and delete existing client from a list
"clientdetail", considering them to act as push and pop
operations of the stack.
11 Write a menu driven program to insert, delete and display
details of student w.r.t student no and name in a stack using
list.
12 Write a menu driven program to add,delete or display
elements of stack.
13 Julie has created a dictionary containing names and marks as
key value pairs of 6 students. Write a program with separate
user defined functions to perform the following operations:
● Push the keys (name of the student) of the dictionary into a
stack, where the corresponding value (marks) is greater than
75.
● Pop and display the content of the stack.
MYSQL
1 Consider the tables given below and answer the questions
that follow:
• Create the table Employee.
• Create the table Department.
• Insert data in the table Employee
• Insert data in the Table Department
• Display the details of all employees.
• Display all from Table Department
• Display the Salary, Zone and Grade of all the
employees.
• Display details of all the employees who are below 30
years of age
• Display names of all employees working in North zone
• Display the salaries of all employees of department 10.
• Display details of all employees whose grade is NULL
• Display details of all employees whose grade is not
NULL.
• Display names of various zones from table Employee. A
zone name should appear once only.
• Display various department numbers from table
Employee
• Display details of all employees of department 10 who
are above and below age of 30.
• Display name,salary and age of all employees whose
name contains “a”.
• Display Name,Salary,Age,Department of all employees
whose name contain “a” as second character.
• Increase salary by 100 whose department is 10
• Delete record of Uday.
• Display sum and average of salaries of all employees.
• Display details of all employees in descending order of
name
• Display number of employees in department 10
• Display highest salary,lowest salary and average salary
of each zone.
• Display details of employees in ascending order of
department name and descending order of names
2 Write SQL queries based on the given two tables-
• To display details of all transactions of TYPE Credit
from Table TRANSACTION
• To display the CNO and AMOUNT of all transactions in
the month of September 2017 from the table
TRANSACTION.
• To display the last date of transaction (DOT) from table
TRANSACTION for customer having CNO as 103.
• To display all CNO, CNAME and DOT of those
CUSTOMERS from tables CUSTOMERS and
TRANSACTION who have done transactions more than
or equal to 2000.
• To display number of transactions and average
transaction amount of customers of have done
transaction after or on 1st June 2017 from Table
TRANSACTION.
• To display CNO, number of transactions and maximum
amount transacted by each customer who have done
more than 1 transaction from Table TRANSACTION.
• To display NO, CNAME of customers not living in DELHI
or CHENNAI from table CUSTOMERS.
• To show different CNO present in Table TRANSACTION.
3 Write SQL queries based on the given two tables:
• Display the Trainer Name, City and Salary in
descending order of their hire date.
• To display the TNAME and CITY of Trainer of joined the
institute in the month of December 2001.
• To display TNAME,HireDate,CNAME,STARTDATE from
tables TRAINER and COURSE whose FEES is less than or
equal to 10000.
• To display number of trainer from each city.
• To display TID,Tname of trainers not living in Delhi or
Mumbai
• To display distinct TID from Course table
• To display TID, number of occurences and its minimum
fees whose number of occurences is more than 1.
• To count and display sum of fees where date is before
15 September 2018.
4 Write SQL queries related to the given two tables-
• To display all the details of those watches whose name
ends with “time”.
• To display Watch’s name and price of those watches
which have price range between 5000-15000.
• To display total quantity in store of Unisex type
watches
• To display watchname and their quantity sold in 1st
quarter.
• To display maximum price and minimum quantity of
watches.
• To display total watches sold in each quarter
• To display watch name,price and type whose id is
present in SALE table
MYSQL AND PYTHON CONNECTIVITY
1 Write a program to create a table named “Employee” and
insert records in it using MySQL and Python connectivity
2 Write a program to create a table named “salgrade” and set
sgrade as primary key and insert sgrade, salary and hra in it.
3 Write a program to display name and designation of those
employees whose sgrade is either S02 or S03.
4 Write a program to add a column CONTACT_NUMBER and add
phone numbers for each employee.
5 Write a program to search the record of highest paid
employee.
6 Write a program to update salary of each employee by
incrementing 10%.
7 Write a program to display minimum DOB and maximum DOJ
from employee table.
8 Write a program to display sgrade and salary+hra where
sgrade is S01.
9 Write a program to count number of records of each grade.
10 Write a program to display name and salary of those
employees whose code is less than 103.
11 Write a program to delete record of those employees whose
name contain letter m.
12 Write a program to delete both tables and the database.

You might also like