0% found this document useful (0 votes)
46 views25 pages

Practical File 2024

Uploaded by

Yash Yadav
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)
46 views25 pages

Practical File 2024

Uploaded by

Yash Yadav
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/ 25

MODERN SCHOOL

FARIDABAD

PRACTICAL RECORD

SUBJECT: INFORMATICS PRACTICES (065)

ACADEMIC YEAR: 2024-25

ROLL NO :

NAME :

CLASS : XII
Name:
Certificate
________________ Class: XII
Roll No. _______________ Exam: AISSCE 2024

Institution: MODERN SCHOOL, SECTOR 17, FARIDABAD

This is certified to be bonafide work of the student in the


Computer Science Laboratory during the academic year
2024-2025.

No. of practical completed are 25 out of 25 in the subject


Informatics Practices (065).

________________ ________________
Teacher In Charge Examiner

________________
Principal
Topic: Pandas Series
Expt 1. Create a Series having 7 car makes
import pandas as pd
l=['Toyota', 'Honda', 'Ford', 'BMV', 'Audi', 'Volkswagen', 'Mercedes']
s=pd.Series(l)
print(s)

Expt 2. Create a Series using 2 lists, One having having car makes and the others
having Index of car make as C1,C2, ..... C7
import pandas as pd
m=['Toyota', 'Honda', 'Ford', 'BMV', 'Audi', 'Volkswagen', 'Mercedes']
i=['C1','C2','C3','C4','C5','C6','C7']
s=pd.Series(m,i)
print(s)

Expt 3. Create a Series to store national sports of some countries, indexed by name
of country. (Using a Dictionary)

import pandas as pd
SportsDict={'India':'Hockey', 'Bhutan':'Archery', 'Japan': 'Sumo',
'China': 'Table Tennis', 'England':'Cricket', 'Italy': 'Football',
'Israel': 'Football', 'Iran':'Wresstling', 'USA':'Baseball'}
NationalSports=pd.Series(SportsDict)
print(NationalSports)
Expt 4. Create a Series for storing Subject Name as elements and subject code as
Index. Display various attributes of a Series
''' 1. Display number of elements
2. Display index
3. Display values
4. Display data type of elements
5. Display size of series
6. Display shape of series
7. Display dimension of series
8. Display count of elements in series
9. Display top 5 elements
10. Display last 5 elements
11. Display elements in sorted order (Ascending)
12. Display elements in reverse order
13. Display top 3 and bottom 3 elements
14. Display Statistics of Series
15. Display Info of Series
'''
import pandas as pd
Subjects=['English','Physics','Chemistry','Biology','Mathematics','Accountancy',
'Bus. Studies','Informatics Practices','Painting','History', 'Political Science',
'Home Science', 'Psychology','Entrpreneurship', 'Economics','Physical
Education']
SubCode=['301','042','043','044','041','055','054', '065', '049', '027','028', '064',
'037','066','030', '048']
SubSeries=pd.Series(data=Subjects, index=SubCode)
print("~"*40)
print(SubSeries)
print("~"*40)
print(len(SubSeries)) #1.
print("~"*40)
print(SubSeries.index) #2.
print("~"*40)
print(SubSeries.values) #3.
print("~"*40)
print(SubSeries.dtype) #4.
print("~"*40)
print(SubSeries.size) #5.
print("~"*40)
print(SubSeries.shape) #6.
print("~"*40)
print(SubSeries.ndim) #7.
print("~"*40)
print(SubSeries.count()) #8.
print("~"*40)
print(SubSeries.head()) #9.
print("~"*40)
print(SubSeries.tail()) #10.
print("~"*40)
print(SubSeries.sort_values()) #11.
print("~"*40)
print(SubSeries.sort_values(ascending=False)) #12.
print("~"*40)
print("Top 3 Elements \n",SubSeries.head(3), "Last Three \n" , SubSeries.tail(3))
#13.
print("~"*40)
print(SubSeries.describe()) #14.
print("~"*40)
print(SubSeries.info()) #15.
Expt 5. Create a Series to store Salary of 5 employees of a company. Write
statements to display minimum, maximum, average, total, index of highest and
lowest value. Incremented Salary (after adding 5% of Present Salary), highest 2 and
lowest 2 salaries

import pandas as pd
Salary=[45000,56000,45980, 34890,54000]
print(Salary)
Salary=pd.Series(Salary)
print(Salary)
print("~"*40)
print("Minimum Salary given : ", Salary.min())
print("Maximum Salary given : ", Salary.max())
print("Average Salary given : ", Salary.mean())
print("Total Salary given : ", Salary.sum())
print("Index of Highest Salary : ", Salary.idxmax())
print("Index of Lowest Salary : ", Salary.idxmin())
print("Incremented Salary \n", Salary+(Salary*5/100))
print("Highest 2 Salaries \n", Salary.nlargest(2))
print("Lowest 2 Salaries \n", Salary.nsmallest(2))

Expt 6. Create a Series that store marks of class test taken by 15 student. Display
the Rollnos of students who got marks above 30.
# Also display the result as True/False for Rollnos getting marks above 30 or not

import pandas as pd
TestMarks=[34,65,34,23,19,36,32,67,15,45,10,22,38,56,9]
RollNo=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
Marks=pd.Series(data=TestMarks, index=RollNo)
print(Marks)
print("~"*40)
print(Marks[Marks>30])
print("~"*40)
print(Marks>30)
Expt 7. Create a Series that store marks of class test taken by 15 student. Display
the Rollnos of students who got marks above 30
# Also display the result as True/False for Rollnos getting marks above 30 or not
import pandas as pd
TestMarks=[34,65,34,23,19,36,32,67,15,45,10,22,38,56,9]
RollNo=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
Marks=pd.Series(data=TestMarks, index=RollNo)
print(Marks)
print("~"*40)
print(Marks[Marks>30])
print("~"*40)
print(Marks>30)
Topic: Pandas DataFrame
Expt 8. Write a program to create a DataFrame in Pandas to Store Marks Obtained
by 'Amit','Sumit','Ramit','Namit','Jatin'
# Row Index will be Student Names and Columns Headings will be in 'PT1','PT2'
and 'PT3' [Using Nested Lists-]

import pandas as pd
TestResult=[[23,14,20], [33,41,25], [33,24,29], [43,34,25],[34,40,27]]
tst=pd.DataFrame(TestResult, columns=['PT1','PT2','PT3'],
index=['Amit','Sumit','Ramit','Namit','Jatin'])
print(tst)

Expt 9. Write a program to create a DataFrame in Pandas to Store Marks Obtained


by 'Amit','Sumit','Ramit','Namit','Jatin'
# Row Index will be Student Names and Columns Headings will be in 'PT1','PT2'
and 'PT3' [Using Dictionary]

import pandas as pd
TestResult={"PT1":[23,33,33,43,34], "PT2":[14,41,24,34,40], "PT3":
[20,25,29,25,27]}
tst=pd.DataFrame(TestResult, index=['Amit','Sumit','Ramit','Namit','Jatin'])
print(tst)
Expt 10. Consider the given Structure and write Python commands to do the questions
that follow:
SportsMan Sport MedalWon
0 Neeraj Chopra Javelin Throw Silver
1 Manu Bhaker Air Pistol Bronze
2 Swapnil Kusale 50 m Rifle Bronze
3 Aman Sehrawat Wrestling Bronze
'''
a. Create a DataFrame Medals using Dictionary
b. Add a row with SportsMan - Indian Men’s Team, Sport - Hockey, MedalWon - Bronze
c. Display the records in arranged in order of SportsMan
d. Add a new column PrizeMoney with values [50 Lakh, 30 Lakh, 30 Lakh, 30 Lakh, 15
Lakh each]
'''
#a.
import pandas as pd
dt={'SportsMan':['Neeraj Chopra', 'Manu Bhaker', 'Swapnil Kusale', 'Aman Sehrawat'],
'Sport': ['Javelin Throw', 'Air Pistol', '50 m Rifle', 'Wrestling'],
'MedalWon':['Silver', 'Bronze', 'Bronze', 'Bronze']}
Medals=pd.DataFrame(dt)
print(Medals)
#b.
Medals.loc[4]=["Indian Men’s Team", 'Hockey', 'Bronze']
print(Medals)
#c.
print(Medals.sort_values(by='SportsMan'))
#d.
Medals['PrizeMoney']= [500000, 300000, 300000, 300000, 150000]
print(Medals)
Expt 11. '''Consider the following Data and write Python Commands to do the
following:
Name Age Gender Height_cms Weight_Kgs
R1 Rohit 25 M 175 70
R2 Surbhi 27 F 160 55
R3 Vanshika 28 F 180 80
R4 Digvijay 32 M 165 60

a. Create the DataFrame df


b. Display rows where age > 27
c. Display the rows from index 1 to index 3
d. Change the age of Vanshika to 34
e. Save the DataFrame as DATA.CSV
'''
import pandas as pd
df=pd.DataFrame([['Rohit',25,'M',175,70], ['Surbhi', 27,'F',160,55],
['Vanhika',28,'F',180,80], ['Digvijay',32,'M',165, 60]],
columns=['Name','Age','Gender','Height_cms','Weight_Kgs'],
index=['R1','R2','R3','R4'])
print(df)
print("~"*40)
print(df[df['Age']>27])
print("~"*40)
print(df.iloc[1:4]) # print(df.loc['R2':'R4'])
print("~"*40)
df.loc['R3','Age']=34
print(df)
print("~"*40)
df.to_csv('DATA.csv')
Expt 12. Write a Python program to create a panda’s DataFrame called DF for
the following table Using Dictionary of List and perform the following operations:
a. To Display only column 'Toys' from DataFrame DF.
b. To Display the row details of 'AP' and 'OD' from DataFrame DF.
c. To Display the column 'Books' and 'Uniform' for 'M.P' and 'U.P' from
DataFrame DF.
d. To Display consecutive 3 rows and 3 columns from DataFrame DF.

Expt 13. Write a Python program to create a panda’s DataFrame called DF for the
following table using Dictionary of List and display the details of students whose
Percentage is more than 85.
Topic: Data Viualisation

Expt 14. Plot a Line Chart


Display the Movie Tickets Sale trend in a week for Morning, Afternoon and Evening
Show
import matplotlib.pyplot as plt
mvd=[1,2,3,4,5,6] # six shows
mtckt=[2000,2250,1500,3250,3000,2800] # tickets sold for each show
etckt=[2550,1800,2200,3000,3100,2900] # tickets sold for evening show
atckt=[2050,1700,2200,3500,3200,4500]
plt.plot(mvd,mtckt, color="g", marker="p", ms=12, linestyle="--", label="Morning
Show")
plt.plot(mvd,atckt, color="m", marker="o", ms=8, linestyle=":", label="Afternoon
Show")
plt.plot(mvd,etckt, color="m", marker="P", ms=8, linestyle=":",label="Evening
Sow")
plt.title("Movie Ticket Sales ")
plt.legend()
plt.xlabel("Days ----->")
plt.ylabel("Tickets sold")
plt.grid(True)
plt.show()
Expt 15. Plot a Line Chart on DataFrame

import pandas as pd
import matplotlib.pyplot as plt
df=pd.DataFrame({'2020':[1000,1200,1400], '2021' : [1200, 1400, 1700], '2022':
[1100,1000,1350], '2023':[1200,1500,1700]}, index=['S1','S2','S3'])
print(df)
df.plot(kind="line", style=["*","p",">","h"], ls=":")
plt.legend()
plt.show()
Expt 16. Plot a Bar Chart

import matplotlib.pyplot as plt


import numpy as np
d1=['ColA','Colb','colC','Cold']
xaxs=np.arange(1,9,2)
s=[10,12,8,14]
h=[8,10,6,10]
c=[6,8,6,8]
plt.bar(xaxs,s, width=.4, label="Science")
plt.bar(xaxs+.4,h,width=.4, label="Humanities")
plt.bar(xaxs+.8,c,width=.4, label="Commerce")
plt.xticks(xaxs,d1)
plt.legend()
plt.show()
Expt 17. Plot a Scatter chart

import pandas as pd
import matplotlib.pyplot as plt
RainCoats=[10,22,34,65,23,18,18,20,22]
Umbrella=[100,120,105,110,100,106,112,108,110]
RainyDays=[1,2,3,4,5,6,7,8,9]
plt.scatter(RainyDays, RainCoats, c='m', s=16, label="Rain Coats")
plt.scatter(RainyDays,Umbrella, marker="p", c='darkblue', s=22, label="Umbrella")
plt.legend()
plt.show()
Expt 18. Plot a Histogram

import matplotlib.pyplot as plt


import numpy as np
data1=[12,14,16,34,23,22,53,23,21,45,24,27,28,19,15,22,26,30,32,33,16,18,20,24,28,
24]
data = np.random.randn(50) # Generate some random data
#print(data)
#plt.hist(data, edgecolor='black')
plt.xlabel('Values')
plt.ylabel('Frequency')
plt.title('Histogram')
#plt.hist(data, bins=3,edgecolor='black')
#plt.hist(data, bins=5, cumulative=True, edgecolor='g', color='y',
orientation="horizontal")
plt.hist(data1, bins=[0,20,40,60],cumulative=True, edgecolor='k', ls='dashed', lw=2,
label="different age groups")
plt.legend()
plt.show()
Topic: CSV Files

Expt 19. Program to write to CSV file


import pandas as pd
import numpy as np
myDict = { 'Name' : ['Jai', 'Princi', 'Gaurav', 'Anuj', "Geetu", "Ria", "Suman",
"Rahul", "Kunal","Sumit" ],
'Height' : [5.1, 6.2, 5.1, 5.2, 5.9, np.NaN,6,4.5,5.5,np.NaN],
'Qualification': ['MA', 'MCom', 'Msc', 'BA', np.NaN, 'MCom', 'Msc', np.NaN, 'BE',
'ME'] }
df = pd.DataFrame(myDict)
print(df)
df.to_csv("e:\\xii_2024\\myd3.csv", na_rep="Not Known", index=False,
columns=["Name", "Qualification"])
df2=pd.read_csv("E:\\xii_2022\myd3.csv")
print(df2)
Expt 20. Program to read CSV file into a DataFrame

import pandas as pd
df=pd.read_csv("E:\\xii_2022\\testing.csv")
print(df)
Topic: SQL Commands
Expt 21
Q1. Consider the given structure:
Tcode Title Audi Language ShowDt TicketRt

T001 Romeo and 2 English 2024-12-12 150


Juliet
a. Write the command to create the table theatre as given below: decide the datatype of
every attribute and identify the Primary key. Default TicketRt is 200, Audi can be 1 or 2
or 3 or 4.
b. Add 3 records.
c. Display the name of plays that will be staged in audi1
d. Display the record of those plays that have language as Hindi
e. Display the name of plays in alphabetical order.
f. Add and attribute Troupe to the table of type string and size 40. it should not be left
blank.
g. Delete the record of those plays that have already been staged.
h. Increase the ticket rate by 25 rupees for all the plays in English language.
i. Display the name of the plays that will be screened in Hindi and English language.
j. Display the name of plays that have ticket price above rs 250.
k. Display all the plays in such a manner that the last one should appear in the beginning.
l. Display all the plays having the word ‘The’ in the title.

SQL Commands:
a. create table Threater
(Tcode char(4) primary key, Title char(20) not null,
Audi int(1) not null, Language char(10),
ShowDt date, TicketRt int(3));
b. insert into Theatre values
(‘T001’, ‘Romeo and Juliet’, 2, ‘English’, ‘2024-12-12’,150),
(‘T002’, ‘Choked’, 1, ‘Hindi’, ‘2024-10-12’, 150),
(‘T003’, ‘Bahubali’, 3, ‘English’, ‘2024-11-10’, 175);
c. Select title from theater where audi=1 and showdt > sysdate();
d. Select title from theater where language=’Hindi’;
e. Select * from theater order by title;
f. Alter table theater add Troupe chr(40) not null;
g. Delete from theater where ShowDt < sysdate();
h. Update Theater set TicketRt=TicketRt+25 where language=’English’;
i. Select title from theater where language = ‘Hindi’ or language= ‘English’;
j. Select title from theater where ticketRt > 250;
k. Select title from theater order by ticketRt desc;
l. Select title from theater where title like ‘%The%’
Expt 22. . Consider the Data given below-do the questions that follows:
DealerC DealerNm City ContactNo TurnOver
d

D001 Sumangal & Sons Faridabad 9898765432 9875.80


a. Create the table to store such info.
b. Display the record of dealers whose name begins with an ‘R’
c. display the record of dealers along with their turnover
d. display the record in alphabetical order of names of the dealer
e. display the name of dealers whose contact number is not known
f. change the contact number for dealer ‘Roy Brothers’.
g. Display the dealer code and name for all based in Amritsar.
h. The name of dealers who are outside Delhi.
i. Display the dealer name having turnover in range of 10000 to 20000.
j. Display the cities from where Dealers are there.
k. The total number of dealers and cities the dealers are in.
l. Display the average , the highest, the lowest turnover.

SQL Commands:
a. create table Dealers
(DealerCd char(4) primary key, DealerNm char(20) not null,
City char(20) not null, ContactNo char(10), TurnOver float(7,2));
b. Select * from Dealers where DealerNm like ‘R%’;
c. Select DealerNm, TurnOver from Dealers ;
d. Select * from Dealers order by DealerNm
e. Select DealerNm from Dealers where ContactNo is null;
f. Update Dealer set contactNo=’9899999999’ where DealerNm=’Roy Brothers’;
g. Select DealerCd, DealerNm from Dealers where city=’Amritsar’;
h. Select DealerNm from Dealers where city != ‘Delhi’;
i. Select DealerNm from Dealers where TurnOver between 10000 and 20000;
j. Select distinct city from Dealers;
k. Select count(*), count(distict City) from Dealers;
l. Select average(turnover), max(turnover), min(turnover) from Dealers;

Expt 23
Consider the table Projects given below. Write commands in SQL
PROJECTS
Id Projname Projsize Startdate Enddate Cost

1 Payroll-Mms Medium 2006-03- 2006-09-16 60000


17

2 Payroll-Itc Large 2008-02- 2008-01-11 50000


12

3 Idmgmt-Litl Large 2008-06- 2009-05-21 Null


13
4 Recruit-Litl Medium Null 2008-06-01 50000

5 Idmgmt-Mtc Small 2007-01- 2007-01-29 20000


15

6 Recruit-Itc Medium 2007-03- 2007-06-28 Null


01

a. to display all information about projects of medium projsize.


b. to list the projsize of projects whose projname ends with litl.
c. to list id, name, size and cost of all the projects in descending order of
startdate.
d. to count the number of projects of cost less than 100000.
SQL Commands:

a. Select * from projects where projsize= ‘Medium’ ;


b. Select projsize from projects where projname like ‘%litl’ ;
c. Select id, projname, projsize, cost from projects order by startdate desc;
d. Select count(*) from projects where cost <100000;

Expt 24
Consider the Registration Table given b and write SQL Commands for Questions that follow:
RegsID RName City TestSeries Level Dt_exam ISP Board SCORE RFee
R0001 Poonam Faridabad Physics II 12-03-2020 I-AXN CBSE 56 500
R0002 Deeksha Palwal Maths I 10-03-2020 JIO ICSE 34 450
R0003 Sudeep Faridabad Chemistry II 13-04-2020 AIRTEL CBSE 450
R0004 Vishal Faridabad English II 10-04-2020 BSNL CAMBRIDGE 23 250
R0005 Parul Palwal Maths II 10-01-2020 BSNL CBSE 6 450
R0006 Ranju Ballabgarh Physics I 13-02-2020 AIRTEL CBSE 34 500
R0007 Seema Faridabad Maths I 12-04-2020 JIO ICSE 450
R0008 Ankush Palwal English II 10-03-2020 BSNL STATE 13 250
R0009 Gaurav Faridabad Maths I 15-04-2020 JIO STATE 450
R0010 Pradeep Faridabad Maths II 10-02-2020 AIRTEL ICSE 65 450
R0011 Saumya Ballabgarh Maths I 15-02-2020 AIRTEL ICSE 32 450
R0012 Vaibhav Faridabad Physics II 10-01-2020 JIO CAMBRIDGE 29 500
a. Display how many students from different Boards have registered for Test.
b. Display highest marks scored for every TestSeries.
c. Display Average score upto one decimal place for every city.
d. Display the city having more than 3 registrations.
e. Display the number of registration for different TestSeries in all the Boards.
f. Display how many exams were / are to be conducted on different dates.
g. Display number of users from each ISP.
h. Display from each city what is the total RegistrationFee collected.
i. Display the city from where less than 2 people have registered for Maths test.
j. Display how many students from each city have registered for different Topics
k. Display ISP for which there are more than 5 users.

SQL Commands:
a. Select max(score) , testseries from Registration group by testseries;
b. Select count(*), board from registration group by board;
c. Select round(avg(score),1) , city from Registration group by city;
d. Select count(*) , city from Registration group by city having count(*)>3
e. Select count(*), level, board city from Registration group by board, level order by board;
f. Select count(*), dt_exam from Registration group by dt_exam;
g. Select count(*),ISP from Registration group by ISP;
h. Select sum(rfee),city from registration group by city;
i. Select city from Registration group by city having count(*) < 2 and testseries=’Maths’;
j. Select count(*), city, testseries from registration group by city, testseries;
k. Select isp from registration group by isp having count(*) > 5;

Expt. 25

XYZ media house - DelhI has four blocks named Z1, Z2, Z3, Z4. The distance between blocks is:
Z1 - Z2. 80 mtrs. Z1 - Z3. 65 mtrs. Z1 - Z4. 90 mtrs.
Z2 - Z3. 45 mtrs. Z2 - Z4. 120 mtrs. Z3 - Z4. 60 mtrs.

No. Of computers:
Z1 - 135, Z2 - 290, Z3 - 180, Z4 - 195

a. Suggest the location of the server.


Z2 - as it has maximum no. of computers

b. Suggest topology and draw it.


Star Topology:
80 Mtr Z1

120 Mtr
Z2 Z2
45 Mtr

Z3

c. Suggest the placement of repeater, hub / switch.

Repeater - it should be placed between Z2 and Z4 as distance between them is more than
hundred metres.
Hub / Switch - it should be placed in each block as each block has many computer that needs to
be included to form a network.

d. Which technology will allow to make voice call using a broadband Internet connection.
VoIP - Voice Over International Protocol

e. What type of network (LAN/ WAN/ MAN/ PAN)will be formed?


WAN - as the distance between Delhi and Mumbai is more than 40 kms.

f. Media house is planning to get its website designed to allow the people to see the news as per
their choice after registering themselves on its server. Out of the static or dynamic which type of
website will you suggest?

Dynamic web-site - as it generates its content in real-time as per user request.

g. Suggest a device is software and its placement that provide data security for the entire network
of the media house.

Firewall - placed with the server at Z2.


h. Suggest a device and the protocol that will be needed to provide wireless internet access to all
smartphone laptop users in the office.

DEVICE: Wi-Fi router / WiMAX/ of wireless modem. PROTOCOL: WAP


i. Suggest the best wired media.
Optical Fiber

You might also like