Professional Documents
Culture Documents
COMPUTER PRACTICAL FILE (Class 12)
COMPUTER PRACTICAL FILE (Class 12)
LANCER’S CONVENT
PRASHANT VIHAR, ROHINI, DELHI-110085
COMPUTER SCIENCE
PRACTICAL FILE
(2022-2023)
OUTPUT
1
2. Write a python program to find the factorial of a number.
Provide the function with default parameters if no user input is
provided. (Factorial of negative numbers is not possible.)
OUTPUT
2
3. Write a program to demonstrate the concept of scope of a
variable.
OUTPUT
3
4. Write a Python function to create and print a list where the values
of the list are square of numbers between 1 and 30 (both
included).
OUTPUT
4
5. Write a program to input 10 numbers from the user and count
how many of these are whole numbers.
OUTPUT
5
6. Create a function calculator () to perform basic mathematical
operations and return multiple values and print them
individually.(needs correction)
OUTPUT
6
7. Read a text file line by line and display each word separated by a
#.
OUTPUT
7
8. Read a text file and display the number of
vowels/consonants/uppercase/lowercase characters in the file.
8
OUTPUT
9
9. Copy the contents of one text file to another text file by removing
all the lines that contain the character 'a'.
OUTPUT
10
10.Write a program to read a text file and display each word
starting from the 2nd letter.
OUTPUT
11
11.Create a binary file with name and roll number. Search for a
given roll number and display the name, if not found display
appropriate message.
12
OUTPUT
13
12. Create a binary file with roll number, name and marks. Input
a roll number and update the marks.
14
OUTPUT
15
13. Write a random number generator that generates random
numbers between 1 and 6 (simulates a dice).
OUTPUT
16
14. Write a program to read the contents of “student.csv” file
using with open().
OUTPUT
17
15. Create a CSV file by entering user-id and password, read
and search the password for given user-id.
OUTPUT
18
16. Write a function file_long() that accepts a file name and
reports the file’s longest line.
OUTPUT
19
17. Write a program to count the number of records present in
“customers.csv” file.
OUTPUT
20
18. Create the following table:
Table: SchoolBus
(a) To show all information of students where capacity is more than the
no of student in order of rtno.
(b)To show area_covered for buses more than 20 km., but charges less
than 80000.
21
(c) To show the area covered by Bhalla Co. and kisan tours
e) To show all the bus routes number where the distance is less than
30.
22
f) To show the area whose names end with ‘r’ in decreasing order of
the area covered.
g) To show rtno, area_covered and average cost per student for all
routes where average cost per student is - charges/noofstudents
23
j) To show the maximum capacity of a bus
l) Add new record with data: (11, “ Moti bagh”,35,32,10,” kisan tours
“, 35000)
24
ii. select min (noofstudents) from schoolbus;
25
v. select count(distinct transporter) from schoolbus ;
26
viii. select transporter, max(charges) from schoolbus group by
transporter ;
27
19. Consider the two tables EMPLOYEE and DEPT
Table :Employee
Table:DEPT
28
b) Display the designation wise list of employees with name, Sal
and date of joining.
e) Show the average salary for all departments with more than
or equal to 2 working people.
29
f) List the count of employees grouped by deptno.
30
j) Display the name of employees who has name starting with
“A”.
m)Display the name who are working in Delhi and getting more
than 5000
31
n) Display the details of employees who are working in
Accounts Department.
o) Find out the name of all employees who are not working in
Mumbai.
32
20. Create the following table PRODUCT and CLIENT and
answer the questions given below.
Table: Product
Table: Client
33
(c) To display the client name ,city from table client and
productname and price from the table product with their
corresponding matching p_id.
34
21. Create the following table CONSIGNOR and
CONSIGNEE and perform the queries given.
Table:Consignor
Table: Consignee
35
(b)To display the
cneeid,cnorname,cnoradress,cneenmae,cneeaddress for
every consignee.
36
22. Create a table CLUB and perform the queries given below:
37
(d) Add a new column mdate and set all values to ’12-12-2021’.
(f) Change the datatype & size of Member_id to character with size
4.
38
(g) Display member ID who reside in Delhi or Gurgoan.
39
(k) Execute the given queries:
a. Select distinct(fees) from club;
40
e. Select Address,sum(Fees) AS Total_fees from club where
Address=’New Delhi’;
41
i. desc club;
j. show databases;
k. show tables;
42
l. Remove the primary key constraint.
43
23. Write a Python program to insert an element into a stack
and display all elements.
OUTPUT
44
24. Write a Python program to remove an element from a stack
and display all elements.
OUTPUT
45
25. Write a Python program to implement a stack using list and
display the element on top of the stack.
OUTPUT
46
26. Integrate SQL with Python by importing suitable module
and retrieve all records from the table product.
OUTPUT
47
27. Perform a delete query on the table products to delete the
product having price greater than 100 using Python MySql
connectivity.
OUTPUT
48