0% found this document useful (0 votes)
53 views5 pages

Class 12 List of Practicals 2022 11 27

Write a Python program to merge two lists by taking one element from each list alternately and appending it to a new list. Write a Python function to create and print a list of squares of numbers between two user-input numbers. Write a Python program using a function with default parameters to calculate simple and compound interest given principal, rate, and time. The function should have default values for rate=3.5% and time=2 years. [END SUMMARY]
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views5 pages

Class 12 List of Practicals 2022 11 27

Write a Python program to merge two lists by taking one element from each list alternately and appending it to a new list. Write a Python function to create and print a list of squares of numbers between two user-input numbers. Write a Python program using a function with default parameters to calculate simple and compound interest given principal, rate, and time. The function should have default values for rate=3.5% and time=2 years. [END SUMMARY]
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

List of Practical for Class 12- Computer Science

Min:15 Python + 05 SQL + 04 Python SQL Connectivity

Ser
Topic Sub Topic Practical
No
Write a Python program to Read two lists. Create a functionMergeList (ListA, ListB) that
Create Function
1. Functions
+ List operation merges two lists such that taking one element from each list one by one and appending
the rest of the items of the list when one list is finished.
Create Function Write a Python function to create and print a list where the values are square of numbers
2. Functions + List Ops + between two numbers (both included). Read two numbers from user and execute the
Maths Function function and print result on screen.
Create Function Write a python program which reads Principal, Rate, Time and uses a function Interest
with Default
which returns Simple interest and compound interest for the same value of PRT. The
3. Functions parameter,
Returning function should have a default value for Rate = 3.5 and Time = 2 years, Compound
Multiple Values interest is calculated yearly.
Local, global Write a python program to demonstrate use of global keyword.
4. Functions
parameters
Read Text, String Write a python program to read text from user and save it in a text file. Read the text file
Handling
5. Text File: and display the number of vowels/ consonants/ uppercase/ lowercase characters in the
(islower, isupper,
membership test) file
Readline, Write a python program read a text file line by line and display each word separated by a
6. Text File: String Method
‘#’.
(split, join)
Readlines, string Write a python program to remove all the lines that contain the character ‘a’ in a file and
7. Text File: Method ( find/
write it to another file.
membership )
Two File Write a Python program to combine each line from first file with the corresponding line in
operation,
second file and append part left from larger file.
8. Text File: List Operation,
Writing into Text
file
Create a CSV Write a python program to create a CSV file that contains record of Name, Admission_No,
9. CSV File file, display date_of_birth and Adhar_Card. Add atleast 5 records in the file. Display the Contents of
contents the file.
You have been given a CSV file that contains the Schedule of Rajdhani train. Write a
Read a CSV File, python program to Find out if the Train stops at a particular station and calculate the
Search, apply
10. CSV File
calculation and stoppage time.
print Format of CSV File is :
SerNo, Station_Name, SchTime_Arriva, SchTime_Dept, Distance
Read a CSV File, A CSV file contains record of Name, Admission_No, date_of_birth and Adhar_Card.
Search, Update
11. CSV File Update the name whose Admission_No = 5 to new name = “Venkat Rama Swami” in the
data and Display
Contents. file. Display the Contents of the file.
Create Binary Create a binary file which stores record of students roll number, name and marks. Read
File, Create
12. Binary File roll number, Name & Marks and store it using Dictionary.
Dictionary, add
contents ,
Read a Binary There is a binary file with name and roll number. Search for a given roll number and
File, Search data
display the name, if not found display appropriate message. Use dictionary for storing
13. Binary File store in a
dictionary object records
and Print it.
Read a Binary There is a binary file with name and roll number of students of your class. The data has
File, Search data
been stored for each student as individual dictionary. Update the name whose Roll
store in a
14. Binary File
dictionary object, Number = 5 to new name = “Venkat Rama Swami” in the file. Display the Contents of the
update it and binary file.
Print it.
Implement all the Write a Python program to implement a stack using a list data-structure. It should have
15. Stack
functions of stack push, pop, isempty functions.
Write a function in Python PUSH_IN (myList), where myList is a list of numbers. From this
Segregate data
list, push all even numbers into a stack which is implemented by using another list named
16. Stack from a list and
Store it in a stack EvenStack. Show the output by taking a sample data of 10 random integers. Implement
this functionality using stack data structure.
Sahil has created a dictionary containing Product names and prices as key value pairs of
4 products. Write a program to implement the following and who its output:
ProductPush() which takes a list as stack and the above dictionary as the
Create a parameters.
Function, Push the keys (Pname of the product) of the dictionary into a stack, where the
Segregate data
17. Stack
from a Dictionary corresponding price of the products is less than 6000.
and Store it in a Example of data: -
stack Product= { "TV" : 10000,
"MOBILE" : 4500,
"PC" : 12500,
"FURNITURE" : 5500 }
Make a python program with function a NumberPush() which takes a list as stack and the
tuple of numbers as the parameters. Push the numbers of the tuple which are divisible by
Create a 5 into a stack. Show the full output
Function,
18. Stack Segregate data
from a tuple and Sample Data:
Store it in a stack M = (2, 10,13,17,25,32,38,44, 56, 60,21, 74, 35,15)
Sample Output
[10, 25, 60, 35, 15]

Networking
Network Study how your school is connected with internet and internal LAN structure. Draw the
Topology, Type
layout of school’s LAN, mark the location where routers, wifi-access point, switches and
of Media,
1. Networking Network Device hubs are connected and Type of media used for connection.
Identification,
Internet Service
Connection
Study how your school is connected with internet. You school canteen is not connected
Internet Service
with internet or Lan. It is proposed to provide wifi internet connection for Teacher. Draw a
2. Networking Connection
Extension layout and plan how can you extend internet service there from existing school internet
infrastructure.
Basic Network Run the following command in your PC and observer the output:
3. Networking Trouble Shooting Ping, ARP -a, IPCONFIG, nslookup, route print
Commands

Database Management - SQL

Implement the following SQL commands on the student table:


Create Table, (a) Create a table Student (Name, Roll_No, Age And Class).
Insert data, (b) Insert two rows of data.
Add a new
1. RDBMS
attribute, (c) ALTER table to add new attributes Adhar Card No.
Update Data, (d) UPDATE table to modify data of Age. Add one to each record.
Delete Data (e) Delete the row having age less than 12 years.

Consider a table SALESMAN with the following data:


SNO SNAME SALARY BONUS DOJ
A01 Akash 25000 106.25 2019-10-14
A02 Ankita 15000 67.33 2012-08-23
B02 Binaya 12500 52.41 2015-02-03
B03 Neesha 35000 NULL 2012-10-08
DML Queries C07 Lalita 10600 45.78 2021-03-17
2. RDBMS based on single
Table
Write SQL queries using SQL functions to perform the following operations:
(a) Display salesman name and bonus after rounding off to zero decimal places.
(b) Display the position of occurrence of the string “TA” in salesman names.
(c) Display the four characters from salesman name starting from second character.
(d) Display the month name for the date of join of salesman .
(e) Display total salary of each employee after adding bonus.

Write SQL commands for the following table MOVIE:

NO TITLE TYPE RATING SEATS_LEFT PRICE


1 Sanju Biopic A 4 250
2 Raid Action B 2 175
3 Race3 Action C 7 245
DML Queries 4 Haami Comedy A 3 130
3. RDBMS based on single
Table
(a) Display the count of number of movies of each type.
(b) Display the movie having highest price.
(c) Display the names of movies starting with letter R of type Action and the seats left is
more than 2.
(d) Delete the movies Race3 from the table.
(e) Update the number of seats left for movie Raid after selling 1 ticket.
Write SQL command for the following situations:

Table: student
Admission_No First_Name Last_Name DOB
012355 Rahul Singh 2005-05-16
012358 Mukesh Kumar 2004-09-15
012360 Pawan Verma 2004-03-03
DML Queries
4. RDBMS based on single
Table (a) Identify the attribute best suitable to be declared as Primary Key. Add a primary
key to the table.
(b) Insert the following data in table student: Admission_No = 012368,
First_Name = Kamlesh, Last_Name = Sharma, DOB=01 Jan 2004.
(c) Delete all the rows which are having letter M in their name.
(d) Show the details of the persons who are having their birthday today.
(e) Display the all details in the order of First name, LastName sorted in descending
order.
Consider the following tables Sender and Recipient. Write SQL commands for the
statements (i) to (iv)
Table: Sender
SenderID SenderName SenderAddress Sendercity
ND01 R Jain 2, ABC Appls New Delhi
MU02 H Sinha 12 Newtown Mumbai
MU15 S Jha 27/A, Park Street Mumbai
ND50 T Prasad 122-K,SDA New Delhi

Table: Recipients
RecID SenderID RecName RecAddress recCity
DML Queries KO05 ND01 R Bajpayee 5, Central Avenue Kolkata
5. RDBMS based on two ND08 MU02 S Mahajan 116, A-Vihar New
Table Delhi
MU19 ND01 H Singh 2A, Andheri East Mumbai
MU32 MU15 P K Swamy B5, C S Terminals Mumbai
ND48 ND50 S Tripathi 13, BI, Mayur Vihar New
delhi

(a) Display the names of all Senders from Mumbai.


(b) Display the RecIC, Sendername, RecName, RecAddress for every Recipient.
(c) Display Recipient details in ascending order of RecName.
(d) Display number of Recipients from each city.
(e) Update the SenderName of ND01 to PK Mohapatra

Consider the following tables Worker and PayLevel and answer (a) and (b) parts of this
question:
E_Code Name Design P_Level DOJ DOB
11 Radhe Shyam Supervisor P001 13-Sep-22 23-Aug-1980
12 Shyam Das Operator P002 02-Jul-20 14-Mar-1986
13 Anant Singh Operator P002 31-Aug-19 21-Feb-1985
14 Albert Sam Mechanic P003 29-Jun-21 26-Oct-1982
15 Sanya Mechanic P003 22-Apr-20 03-Dec-1981
18 Tanya Operator P002 12-May-22 11-Nov-1989

DML Queries
P_Level Basic_Pay Allowance
6. RDBMS based on two P001 35000 10000
Table P002 30000 8000
P003 25000 7000

Write SQL commands for the following statements:


(a) To display the name of all Workers in descending order of DOB.
(b) To display NAME and DESIGN of those Workers, whose Pay Level is either P001
or P003
(c) To display the content of all the workers table, whose DOB is in between ’19-JAN-
1981′ and ’22-Mar-1986′.
(d) To add a new row with the following:
19, ‘DayaKishore’, ‘Operator’, ‘P003′, ’19- Sep-2008’, ‘ll-
Jul-1984’
Consider the following tables Worker and PayLevel and answer (a) and (b) parts of this
question:
E_Code Name Design P_Level DOJ DOB
11 Radhe Shyam Supervisor P001 13-Sep-22 23-Aug-1980
12 Shyam Das Operator P002 02-Jul-20 14-Mar-1986
13 Anant Singh Operator P002 31-Aug-19 21-Feb-1985
14 Albert Sam Mechanic P003 29-Jun-21 26-Oct-1982
15 Sanya Mechanic P003 22-Apr-20 03-Dec-1981
DML Queries 18 Tanya Operator P002 12-May-22 11-Nov-1989
7. RDBMS based on two
Table
P_Level Basic_Pay Allowance
P001 35000 10000
P002 30000 8000
P003 25000 7000

Give the output of the following SQL queries :


(a) Select Count (P_Level), P_Level From Worker Group By P_Level;
(b) Select Max(Dob), Min(Doj) From Worker;
(c) Select Name, Pay From Worker W, PayLevel P
Where W.P_Level = P.P_level And W.E_Code <13;

Practical Python - MySQL Connectivity

Write a Python code to Create Database, Table and add student using MySQL
connectivity and show result. The structure of table is:
Database Name DB_KVSchool
Python SQL UserId StudentLogin
1. Python - Connectivity –
Password aS23Jk
MySQL Database
creation Name of Table Tbl_Student ( RollNo, Name, Age, Class, City)
Constraints : Primary Key RollNo
Constraints : Not Null Roll No, Name, Age Can’t be Null
Write a Python code to search student whose age is between 12 and 14 and belongs to
City Basohli in database using MySQL connectivity and show result.:
Host Localhost
Database Name DB_KVSchool
UserId StudentLogin
Password aS23Jk
Table : tbl_Student
Python SQL Roll_No Student_Name Age Class City
Python - Connectivity –
1 A Kumar 12 7 Kathua
2.
MySQL DML Query,
Show result 2 B Tiwari 13 7 Lakhanpur
3 C Pandey 14 8 Kathua
4 D Jasrotia 11 7 Kathua
5 E Yadav 12 8 Lakhanpur
6 F Tiwari 13 7 Dhanore
7 G Sharma 14 8 Basohli
8 H Gupta 12 7 Basholi

Write a Python code to delete details of student as per given roll number in database
using MySQL connectivity and show result.
Host Localhost
Database Name DB_KVSchool
UserId StudentLogin
Password aS23Jk
Table : tbl_Student
Python SQL
3. Python - Connectivity – RollNo Name Age Class City
MySQL DML Query, 1 A Kumar 12 7 Kathua
Show result
2 B Tiwari 13 7 Lakhanpur
3 C Pandey 14 8 Kathua
4 D Jasrotia 11 7 Kathua
5 E Yadav 12 8 Lakhanpur
6 F Tiwari 13 7 Dhanore
7 G Sharma 14 8 Basohli
8 H Gupta 12 7 Basholi
Write a Python code to update the age of all students of the class by 1 Year in database
using MySQL connectivity and show result.
Host Localhost
Database Name DB_KVSchool
UserId StudentLogin
Password aS23Jk
Table : tbl_Student
Python SQL RollNo Name Age Class City
Python - Connectivity –
4. 1 A Kumar 12 7 Kathua
MySQL DML Query,
Show result 2 B Tiwari 13 7 Lakhanpur
3 C Pandey 14 8 Kathua
4 D Jasrotia 11 7 Kathua
5 E Yadav 12 8 Lakhanpur
6 F Tiwari 13 7 Dhanore
7 G Sharma 14 8 Basohli
8 H Gupta 12 7 Basholi

You have been provided with the table with following details.
Host Localhost
Database Name DB_KVSchool
UserId StudentLogin
Password aS23Jk
Table : tbl_Student

RollNo Name Age Class City

1 A Kumar 12 7 Kathua
Python SQL 2 B Tiwari 13 7 Lakhanpur
Python - Connectivity – 3 C Pandey 14 8 Kathua
5.
MySQL DML Query,
4 D Jasrotia 11 7 Kathua
Show result
5 E Yadav 12 8 Lakhanpur
6 F Tiwari 13 7 Dhanore
7 G Sharma 14 8 Basohli
8 H Gupta 12 7 Basholi

Write a Python code to insert a new record (studying in class 8, Roll No = 9, Age is 14,
Name of the student is J Kumar, residing in City Dhanore) in above mentioned table
database using MySQL connectivity and show result. The sequence of the fields to be
inserted in the SQL query should be in the sequence Class, Age, Name, City.

You might also like