COMPUTER SCIENCE
PRACTICAL FILE
SESSION: 2023-24
CLASS: XII-A
Submitted by: Yash Dutt
Submitted to: Mrs. Ujjwal Garg
[Link] a text file line by line and display each word separated by
a #.
OUTPUT:
[Link] a text file and display the number of vowels/
consonants/ uppercase / lowercase characters
OUTPUT:
[Link] all the lines that contain the character 'a' in a file and
write it to another file.
Input File:
OUTPUT:
[Link] a binary file with name and roll number. Search for a given roll
number and display the name, if not found display appropriate message.
OUTPUT:
[Link] a binary file with roll number, name and marks. Input a
roll number and update the marks.
OUTPUT:
[Link] a random number generator that generates a
random number between 1 and 6 (simulates a dice).
OUTPUT:
4
[Link] a Python program to implement a stack using list.
OUTPUT:
[Link] a CSV file by entering user-id and password, read
and search the password for given user id.
OUTPUT:
[Link] the factorial of a natural number.
OUTPUT:
[Link] the sum of all elements of a list.
OUTPUT:
[Link] a recursive code to compute the nth Fibonacci
number.
OUTPUT:
[Link] a binary program to read, search, update, delete
records.
OUTPUT:
[Link] to write data onto “student” CSV file using
writerow() method.
OUTPUT:
[Link] a program to find the roots of a quadratic function.
Output:
[Link] a menu -driven program for performing all the operations on a
table 'student'.
OUTPUT:
4 Programs based on Python – Sql
connectivity
The operations on Mysql table “emp” involve reading,updating,
and deleting records of employees.
[Link] to read and fetch all the records from EMP
table having salary more than Rs. 70000.
OUTPUT :
[Link]
to update the records of employees
by increasing salary by Rs. 1000 of all those employees
whoare getting less than Rs. 80000.
Output :
[Link]
to delete the record on the basis of inputted
salary.
Output :
[Link]
to insert the student details in the student table.
5 sets of Sql queries
Set
1
[Link] a student table and insert data. Implement the
followingSQL commands on the student table:
1. ALTER table to add new attributes / modify data type / drop attribute
OUTPUT:
[Link] table to modify data
[Link] By to display data in ascending / descending order.
[Link] to remove tuple(s)
OUTPUT:
[Link] BY and find the min, max, sum, count andaverage
Set 2
[Link] the table company and model
Write the SQL commands for the Queries:
[Link] display details of all models in th eModel table in ascending order
of the DateOfManufacture.
SELECT * FROM Model ORDER BY DateOfManufacture;
[Link] display details of those models manufactured in 2011 and whose cost isbelow 2000
SELECT * FROM Model WHERE year (DateOfManufacture) = 2011 AND Cost <2000;
[Link] display the Model_ID, Comp_ID, Cost from the table Model, CompNameand
ContactPerson from Company table , with their corresponding Comp_ID.
SELECT Model _ID, Comp_ID, Cost, CompName, ContactPerson FROMModel,
Company WHERE Model.Comp_ID = Company.Comp_ID;
[Link] decrease the cost of all the models in Model table by 15%
UPDATE Model SET Cost = Cost - 0.15*Cost;
[Link] COUNT(DISTINCT CompHO) FROM Company;
SET 3
[Link] the table employee and salgrade given below
(A).Write SQL commands for the following statements:
[Link] display the details of all EMPLOYEEs in descending order of DOJ
SELECT * FROM EMPLOYEE ORDER BY DOJ DESC;
[Link] display NAME and DESIG of those EMPLOYEEs whose SALGRADE is eitherS02 or S03;
SELECT NAME,DESIG FROM EMPLOYEE WHERE SGRADE=’S02’ OR SGRADE=’S03’;
[Link] display the content of the entire EMPLOYEEs table, whose DOJ is
inbetween ‘09-Feb-2006’ and ‘08-Aug-2009’
SELECT * FROM EMPLOYEE WHERE DOJ BETWEEN ‘2006-02-09’ AND ‘2009-08-
02’
[Link] add a new row with the following content:
109,’Harish Roy’,’HEAD-IT’,’S02’,’9-Sep-2007’,’21-Apr-1983’
INSERT INTO EMPLOYEE VALUES(109, ‘Harish Roy’, ‘HEAD-IT’, ‘S02’, ‘2007-09-09’,‘1983-04-21’);
(B).Give the output of the following SQL queries:
[Link] COUNT(SGRADE), SGRADE FROM EMPLOYEE GROUP BY SGRADE;
[Link] MIN(DOB), MAX(DOJ) FROM EMPLOYEE;
[Link] SGRADE, SALARY+HRA FROM SALGRADE WHERE SGRADE = ‘S02’;
Set 4
TABLE – teacher
[Link] show information about the teacher of the History
department. select * from teacher where DEPT=”History”;
[Link] list the name of female student who are in Hindi
department . select * from student where
department=”hindi” and sex=”f”;
[Link] list the name of all student with their data of admission in ascending order.
select * from student order by dataofadm;
[Link] display students name , fee , age for male
students only. select name , fee , age of student where
sex =”m”;
[Link] count the number of student with
Age>23.
select count(*) from student age>23;
SET 5
TABLE-HOSPITAL
[Link] increase the charges of all the patients by 5% .
update hospital set charges= charges+(charges*5)/100;
[Link] remove the record of the patient whose name is tarun .
delete from hospital where name = “tarun”;
[Link] add another column DocName (Doctor Name) of the type varchar in the above table.
alter table hospital add DocName varchar(20);
[Link] display patient detail whose age is missing(null).
select* from hospital where age is NULL;
[Link] decrease the charges by 5% of all the patients admitted to the ENT department.
update hospital set charges = charges-(charges*5)/100 where department =”ENT”;