Professional Documents
Culture Documents
IP TERM-1 Study Material (Session 2021-22)
IP TERM-1 Study Material (Session 2021-22)
IP TERM-1 Study Material (Session 2021-22)
Class XII
INFORMATICS PRACTICES (065)
Session 2021-22
Sh. M.L.Mishra
Assistant Commissioner
KVS RO Agra Region
Co-ordinator
Mrs. Neetu Verma
Principal
K.V. NO. 3 Agra
TERM – 1
Syllabus
Informatics Practices (Code No. 065 )
CLASS XII
Session : 2021-22
Pandas
Pandas is an open source, BSD library built for Python Programming language. Pandas
offers high- performance, easy to use data structure and data analysis tools. Work with pandas
we need to import pandas library in python environment using below syntax.
Import pandas as pd
OR
Import pandas
You can use this syntax in either in shell prompt or in your script file (.py).
It can read and write many different data formats (integer, float, double etc.).
It can calculate in all the possible ways data is organised i.e. across rows and down
columns.
It can easily select subsets of data from bulk data sets. It has functionality to find and
filled missing data.
It allow to apply operations to independent group within data.
It supports reshaping of data in different formats.
It support advanced time –series functionality
It support visualization by integrating matplotlib library.
In other words Pandas is the best library at handling huge tabular data sets comprising different
data formats.
Matplotlib
First download wheel package of matplotlib as per python version installed. For this go
to the link https://pupi.org/project/matplotlib/#files.
Importing PyPlot
To use PyPlot first import it in your python environment using following commands:
import matplotlib.pyplot
OR
import matplotlib.pyplot as pl
Answer : d) NaN
Q2 Mr X sitting on hot seat of KBC game of Sony TV and Mr Amitabh Bachhan ask a question to
Mr X that one of the statement is not correct. You help to Mr X for finding the correct answer :
a) import matplotlib.pyplot
b) matplotlib.PyPlot as pl
c) import matplotlib.pyplot as plt
d) matplotlib.pyplot.plot(x,y)
Answer : b) matplotlib.PyPlot as pl
Q3 PANDAS stands for _____________
a) Panel Data Analysis
b) Panel Data analyst
c) Panel Data
d) Panel Dashboard
Q4 which of the following library in Python is used for plotting graphs and visualization.
a) Pandas
b) NumPy
c) Matplotlib
d) None of the above
Ans. C) Matplotlib
Q5 Read the following code: Identify the purpose of this code and choose the right option from
the following.
C:\Users\YourName\AppData\Local\Programs\Python\Python36-32\Scripts>pip – version
Eg-
Index Data
Jan 31
Feb 28
Mar 31
Apr 30
1. Array
2. Dict
3. Scalar value or constant
1. Using Series ( )-
# Addition Operation
ua=s+t
print (ua)
0 2
1 4
2 7
dtype: int64
# Multiplication Operation
um=s*t
print (um)
0 1
1 4
2 12
dtype: int64
# Division Operation
>>> ud=s/t
>>> print(ud)
0 1.00
1 1.00
2 0.75
dtype: float64
# Subtraction Operation
>>> us=t-s
>>> print(us)
0 0
1 0
2 1
dtype: int64
Attribute Description
OBJECT SLICING
Q1. Assertion (A): Empty series can be created by using Series () function.
Reason (R): Series () function can create empty series having no values.
import pandas as pd
s = pd.Series([1,2,3,4,5],index = ['a','b','c','d','e'])
print s['a']
A. 1
B. 2
C. 3
D. 4
import pandas as pd
import numpy as np
s = pd.Series(np.random.randn(2))
print (s.size)
A. 0
B. 1
C. 2
D. 3
import pandas as pd
import numpy as np
s = pd.Series(np.random.randn(4))
print(s.ndim)
A. 0
B. 1
C. 2
D. 3
Q7. Which of the following thing can be data in Pandas Series?
A. a python dict
B. an ndarray
C. a scalar value
D. all of the mentioned
Q8. What is correct syntax to add the labels “x”, “y” and “z” to a Pandas Series?
A. pd.Series(mylist, names = ["x", "y", "z"])
B. pd.Series(mylist, index = ["x", "y", "z"])
C. pd.Series(mylist, lables = ["x", "y", "z"])
D. pd.Series(mylist, renames = ["x", "y", "z"])
Q9. Best way to import the pandas module in your program ?
A. .import pandas
B. import pandas as p
C. from pandas import *
D. All of the above
A. Values
B. Indexes
C. NaN
D. Data types
A. print(s[‘nagpur’])
B. print(s[0’])
C. print(s[1])
D. None of the above
15. For given two sequences
x=[10,20,30,40]
y=[[‘M’,’N’,’O’,’P’]
to create a series which of the following is not correct?
A. S=pd.Series(data=x,index=y)
B. S=pd.Series(x,index=y)
C. S=pd.Series(x,y)
D. S=pd.Series(data=x,index=y,type=np.float64)
16. Assertion (A): While creating a series object then there is no compulsion for the
uniqueness of indexes.
Reason(R): Index label cannot be duplicate for a series object.
0 5.0
1 6.0
2 NaN
Reason(R): Pandas automatically convert integer to floating type as NaN is not supported by
integer type.
S= pd.Series([3,6,8])
print(S.index)
A. Index([0,1,2])
B. Int64Index([0,1,2], dtype=Int64)
C. RangeIndex(start=0,stop=3,step=1)
D. [0,1,2]
20. Shardul wants to display 10 values from the bottom/end of series ‘s2’. Mitali suggest him
to write following commands:
(i) print(s2.tail(10))
(ii) print(s2[s2.count()-10:])
What do you think about both the commands?
Question Answer
1. C
2. A
3. A
4. C
5. C
6. B
7. D
8. B
9. D
10. D
11. d
12. B
13. C
14. A
15. D
16. a
17. B
18. D
19. C
20. c
21. c
22. c
23. d
24. a
25. a
Pandas Data Structure- DataFrames
DataFrames
• Dataframe is a two dimensional data structure that is like a two dimensional
ndarray but is more powerful than ndarrays.
• Like series dataframe is a labelled array where rows and columns both can have
labels as in series.
• Dataframe has two indexes or axis; row index (axis=0) and a column index
(axis=1)
• Every value stored in Dataframe is identified through both indexes i.e. row index
and column index (or labels if defined).
• Different columns can have the values from different data types but all values in
a single column will be of the same datatype.
• The values stored in a Dataframe can be changed i.e. it is value mutable.
• Rows or columns can be added in an existing Dataframe i.e. it is size-mutable.
Understanding DataFrame
Column Labels
Index
Creating Dataframes
• To create Dataframes Python Pandas library must be imported.
Syntax : import pandas as pd
A Dataframe can be created using DataFrame() function in pandas library
DataFrame can be created from objects of different datatype:
From Two Dimensional Dictionaries i.e. dictionaries having lists or
dictionaries or ndarrays or series etc.
Two Dimensional Arrays
Series type objects
Another Dataframe objects
DataFrame() function in Pandas
names = pd.Series(['AJAY','RICHA','PRAGYA','MOHIT'])
bstscore =pd.Series([78,73,65,82])
ipscore= pd.Series([82,85,91,75])
df = pd.DataFrame({"NAME":names,"BST":bstscore,"IP":ipscore})
NAME BST IP
0 AJAY 78 82
1 RICHA 73 85
2 PRAGYA 65 91
3 MOHIT 82 75
d1 = {'NAME': 'AJAY','BST':78,'IP':82}
d2 = {'NAME': 'RICHA','BST':73,'IP':85}
d3 = {'NAME': 'PRAGYA','BST':65,'IP':91}
d4 = {'NAME': 'MOHIT','BST':82,'IP':75}
df = pd.DataFrame([d1,d2,d3,d4])
NAME BST IP
0 AJAY 78 82
1 RICHA 73 85
2 PRAGYA 65 91
3 MOHIT 82 75
Creating Dataframe from 2-D List
Example:
data = [ [41,42],[38,45],[42,39] ]
df=pd.DataFrame(data, columns=[“IP”,”BST”], index= [“Ajay”,”Richa”,”Pragya”])
IP BST
Ajay 41 42
Richa 38 45
Pragya 42 39
DataFrame Attributes
Attribute : Attributes give the information about DataFrame. A few common attributes:
Syntax : DataframeName.attribute
Syntax : DataframeName.ColumnName
Example: DFMarks[‘ENG’]
By using the above syntax only rows or only columns can also be selected. A range of rows or
columns can be given or a list of row and column can be given
NAME BST IP
0 AJAY 78 82
1 RICHA 73 85
2 PRAGYA 65 91
3 MOHIT 82 75
Output:
0
NAME AJAY
BST 78
IP 82
Name: 0, dtype: object
1
NAME RICHA
BST 73
IP 85
Name: 1, dtype: object
2
NAME PRAGYA
BST 65
IP 91
Name: 2, dtype: object
3
NAME MOHIT
BST 82
IP 75
Name: 3, dtype: object
Iterating DataFrame over Columns(Column wise)
To iterate a Dataframe Column wise iteritems() function is used:
Example:
Using del statement : It deletes one column at a time/ works on column only. It performs
operation in-place only.
Using drop() method of dataframe : It can delete multiple rows or columns at a time. It can
perform both way in-place or not in-place by specifying the value for argument inplace to True
or False.
Syntax : DataFrameName.describe()
head(n): Returns the top n rows from the dataframe (by default n=5)
Syntax : Dataframe.head(n)
tail(n) : Returns the bottom n rows from the dataframe (by default n=5)
Syntax : Dataframe.tail(n)
Renaming Rows/Columns: Labels of all or selected rows and columns can be changed using
rename() function:
Syntax : Dataframe.rename(index=dictionary,columns=dictionary,inplace=True|False)
To rename rows index argument is to be specified while to rename columns, columns argument
is to be specified. The value of inplace argument if set to True specifies that the changes will
be made to original dataframe and if set to False the changes will be made but a new
dataframe will be returned and original dataframe will not be changed.
The index and columns both arguments can be specified if row and column labels both are to be
modified.
The values for index and columns arguments are to be specified a dictionary object in which the
old label of row column is specified as the key and the new name is specified as value. This
dictionary object can have as many key:value pairs as are to be renamed.
Indexing : Indexing in dataframe is a process of selecting some rows or columns or both from
data i.e. selecting a subset of dataframe. We have seen how to do this using .loc or .iloc. In
which we can select particular rows, columns or both by specifying their index/labels.
Boolean Indexing : Boolean indexing is also the process of selecting subset of dataframe but not
by specifying row or column index/labels. In boolean indexing we obtain subset of dataframe
based on some boolean expression (comparision) i.e. is based on the data stored inside
dataframe.
Operators for boolean indexing
Relational Operators: <, >, <=, >=, !=, ==
Logical Operators: & (and), |(or), ~ (not)
To increase precedence : use parenthesis whenever required and for clarity. Always use
parenthesis for each condition whenever combining multiple conditions with & or | as these
operators have higher precedence than relational operators.
Syntax : DataFrameName.to_csv(‘FilePath’)
Example: DataFrameName.to_csv(‘D:\\Mydata\\df.csv’)
Since \ is an escape sequence character we must use \\ in place of \ while specifying path
Creating DataFrames from CSV Files
index_col argument specifies which column from the CSV file will become the index(row index)
in the Dataframe being created. If it is not specified then pandas itself will create zero based index
for all rows and all columns in CSV file will become the column in the DataFrame.
Q.3 Which function is used to iterate over all columns in the Dataframe?
i iterrows()
ii iteritems()
iii itercolumns()
iv itervertial()
Q.6 Richa is analyzing Gross Enrolment Ratio in Higher Education of India in respect of
marginalized sections and created following Dataframe dfGER:
dfGER
SC ST
2015 19.10 13.70
2016 19.90 14.20
2017 21.10 15.40
2018 21.80 15.90
2019 23.00 17.20
a. She wants to add a column “All” with values 24.30,24.50,25.20,25.80, & 26.30
respectively for each year, which of the following should she use:
i. dfGER.addcolumn[“All”]= [24.30,24.50,25.20,25.80,26.30]
ii. dfGER[“All”]= [24.30,24.50,25.20,25.80,26.30]
iii. dfGER.All= [24.30,24.50,25.20,25.80,26.30]
iv. dfGER.column[“All”]= [24.30,24.50,25.20,25.80,26.30]
b. She wants to see the data in respect of years 2016,2017 & 2018, which of the
following statement should she use:
i. dfGER.iloc[‘2016’ : ’2018’]
ii. dfGER.iloc[:, ‘2016’ : ’2018’]
iii. dfGER.iloc[:, 1:4]
iv. dfGER.iloc[1:4]
c. Which of the following statement will give him the details of ST column only in
respect of all years:
i. dfGER.ST
ii. dfGER[“ST”]
iii. both i and ii
iv. None of these
d. Which of the following statement will be used to remove the row containing the
details of 2015 from the Dataframe.
i. d.drop(labels=2015,axis=0, inplace=False)
ii. d.drop(labels=2015,axis=0, inplace=True)
iii. d.del(labels=2015,axis=0, inplace=False)
iv. d.del(labels=2015,axis=0, inplace=True)
e. She wants to save the Dataframe for further use in a CSV file, identify correct
statement out of following:
i. pandas.to_csv(“GER.SCSV”)
ii. pandas.write_csv(“GER.SCSV”)
iii. pandas.save_csv(“GER.SCSV”)
iv. pandas.writeto_csv(“GER.SCSV”)
Q.7 a. (A) Assertion: Pandas series can not be used to create DataFrame
(R) Reason: Every column of DataFrame is a pandas series.
i. Both A and R are correct but R is not correct explanation of A
ii. Both A and R are correct and R is correct explanation of A
iii. R is correct but A is incorrect
iv. A is correct but R is Incorrect
DataFrame – dfm
a. Which of the following will be used to show the details of ACC column only:
i. dfm.acc
ii. dfm.ACC
iii. dfm[‘acc’]
iv. all of these
b. Which of the following will be used to show the details of DAVID only :
i. dfm.iloc[3]
ii. dfm.iloc[4]
iii. dfm.iloc[‘DAVID’]
iv. All of these
c. Which of the following will be used to show the marks of Amit in IP:
i. dfm.IP['AMIT']
ii. dfm[4,[‘IP’]]
iii. dfm["IP"]["AMIT"]
iv. i and iii
d. Which of the following will be used to show the columns of IP and BST only where
IP is first and then BST is second column:
i. dfm.iloc[:,3:1:-1]
ii. dfm.iloc[:,3:1:-2]
iii. dfm.iloc[:,3:0:-1]
iv. dfm.iloc[:,3:0:-2]
e. If the rows of ROHINI, AVIKA, DAVID are to be shown along with all subject columns
where the order of Rows should be ROHINI, AVIKA and DAVID what should be the
statement out of the following:
i. dfm.loc["ROHINI":"RICHA":-2]
ii. dfm.loc["ROHINI":"DAVID":-3]
iii. dfm.loc["ROHINI":"RICHA":-3]
iv. dfm.loc["ROHINI":"MANISH":-2]
f. Which of the following statement will be used to show the details of ENG, BST and
ECO columns.
i. dfm.iloc[:,'ENG','BST','ECO']
ii. dfm.iloc[:,0,1,4]
iii. dfm.iloc[:,[0,1,4]]
iv. dfm.iloc[:,1,2,5]
g. Which statement will be used to score of MANISH, AMIT and PRAGYA in subject
ENG, BST and IP.
i. dfm.iloc[[2,4,5],[0,1,3]]
ii. dfm.iloc[2,4,5: 0,1,3]
iii. dfm.iloc[[3,5,6],[1,2,4]]
iv. dfm.iloc[3,5,6: 1,2,4]
i. dfm.loc[:,"PE"]=[78,58,63,95,67,83,94,92,77,68 ]
ii. dfm[“PE”]= [78,58,63,95,67,83,94,92,77,68 ]
iii. dfm.addcol(“PE”, [78,58,63,95,67,83,94,92,77,68 ])
iv. i and ii
j. She found later after creating dataframe that she has put marks wrongly in subjects
BST & Accountancy, to manage with mistake she wants to rename the columns of
BST as ACC and ACC as BST. Which statement should she use out of following:
i. dfm.rename(columns={'BST':'ACC','ACC':'BST'})
ii. dfm.rename(columns={'BST':'ACC','ACC':'BST'}, inplace=True)
iii. dfm.rename(columns={'BST':'ACC','ACC':'BST'}, inplace=False)
iv. dfm.rename(columns={'BST':'ACC','ACC':'BST'}, inplace=”True”)
Q.9 M/s ComTech Systems pvt. Ltd. is a company dealing in IT products, following
dataframe dfp is an extraction their database to be analyzed for making policy
decisions before actual analysis basic tasks are to be done. Answer following
questions to perform these basic tasks:
DataFrame : dfp
a. Which statement out of following will remove the column Model from the
dataframe:
i. del dfp.Model
ii. del dfp[“Model”]
iii. drop dfp.Model
iv. drop dfp[“Model”]
b. Select which statement will delete all the rows having label LAPTOP from the
existing dataframe:
i. dfp.drop(labels='LAPTOP',axis=0,inplace=True)
ii. dfp.drop(labels='LAPTOP',axis=1)
iii. dfp.drop(index='LAPTOP',inplace=True)
iv. i and iii
c. Which statement will give a new dataframe after renaming the column Brand as
Comp and Row label laptop as NBOOK:
i. dfp.rename(index={'LAPTOP':'NBOOK'}, columns={'Brand':"Comp"})
ii. dfp.rename(index={'LAPTOP':'NBOOK'}, columns={'Brand':"Comp"},
inplace= ‘True’)
iii. dfp.rename(index=['LAPTOP','NOTEBOOK'], columns=['Brand',"Company"])
iv. Two Separate statement will be required to rename columns and rows.
d. Which of the following statement is correct to get a new dataframe newdf after
deleting column Qty:
e. Which of the following is correct to Retrive the details of all products from Brand
KTEK and pricing more than 25000.
i. dfp[(dfp.Brand=="KTEK") and (dfp.Price>25000)]
ii. dfp[(dfp.Brand=="KTEK") & (dfp.Price>25000)]
iii. dfp[dfp.Brand=="KTEK" and dfp.Price>25000]
iv. dfp[ dfp.Brand=="KTEK" & dfp.Price>25000]
Answer Key
Q.1 iv
Q.2 iii
Q.3 ii
Q.4 i
Q.5 iv
Q.6
a. ii
b. iv
c. ii
d. ii
e. i
Q.7
a.b. iii
iiic. i
d. iv
e. Iv
Q.8
a. ii
b. i
c. iv
d. iv
e. ii
f. iii
g. i
h. ii
i. Iv
j. ii
Q.9
a. ii
b. iv
c. i
d. iv
e. Ii
Data Visualization
"A picture is worth a thousand words". Most of us are familiar with this statement. Data
visualization plays an essential role in the representation of both small and large-scale data. It
especially applies when trying to explain the analysis of increasingly large datasets.
Data visualization is the discipline of trying to expose the data to understand it by placing it in a
visual context. Its main goal is to distill large datasets into visual graphics to allow for easy
understanding of complex relationships within the data.
Several data visualization libraries are available in Python, namely Matplotlib, Seaborn, and
Folium etc.
• Saving – After drawing and customization plots can be saved for future use.
• Create a .py & import matplotlib library in it using - import matplotlib.pyplot as plt statement
• HISTOGRAM etc.
Line Plot:
A line plot/chart is a graph that shows the frequency of data occurring along a number line.
The line plot is represented by a series of datapoints connected with a straight line. Generally
line plots are used to display trends over time. A line plot or line graph can be created using the
plot() function available in pyplot library. We can, not only just plot a line but we can explicitly
define the grid, the x and y axis scale and labels, title and display options etc.
E.G.PROGRAM
import numpy as np
import matplotlib.pyplot as plt
year = [2014,2015,2016,2017,2018]
jnvpasspercentage = [90,92,94,95,97]
kvpasspercentage = [89,91,93,95,98]
plt.plot(year, jnvpasspercentage, color='g')
plt.plot(year, kvpasspercentage, color='orange')
plt.xlabel(‘Year')
plt.ylabel('Pass percentage')
plt.title('JNV KV PASS % till 2018')
plt.show()
Note:- As many lines required call plot() function multiple times with suitable arguments.
Bar Graph
A graph drawn using rectangular bars to show how large each value is. The bars can be horizontal
or vertical. A bar graph makes it easy to compare data between different groups at a glance. Bar
graph represents categories on one axis and a discrete value in the other. The goal bar graph is
to show the relationship between the two axes. Bar graph can also show big changes in data over
time
e.g program
import matplotlib.pyplot as plt
import numpy as np
label = ['Anil', 'Vikas', 'Dharma', 'Mahen', 'Manish', 'Rajesh']
per = [94,85,45,25,50,54]
index = np.arange(len(label))
plt.bar(index, per)
plt.xlabel('Student Name', fontsize=5)
plt.ylabel('Percentage', fontsize=5)
plt.xticks(index, label, fontsize=5, rotation=30)
plt.title('Percentage of Marks achieve by student Class XII')
plt.show()
#Note – use barh () for horizontal bars
HISTOGRAM
A histogram is a graphical representation which organizes a group of data points into user-
specified ranges.
Histogram provides a visual interpretation of numerical data by showing the number of data
points that fall within a specified range of values (“bins”). It is similar to a vertical bar graph but
without gaps between the bars.
import numpy as np
import matplotlib.pyplot as plt
data = [1,11,21,31,41]
plt.hist([5,15,25,35,45, 55], bins=[0,10,20,30,40,50, 60], weights=[20,10,45,33,6,8],
edgecolor="red")
plt.show()
Customization of Histogram –
By default bars of histogram is displayed in blue color but we can change it to other color with
following code . plt.hist([1,11,21,31,41, 51], bins=[0,10,20,30,40,50, 60], weights=[10,1,0,33,6,8],
facecolor='y', edgecolor="red")
In above code we are passing ‘y’ as facecolor means yellow color to be displayed in bars.
To give a name to the histogram write below code before calling show()
plt.title("Histogram Heading")
Edge color and bar color can be set using following parameter in hist() method
edgecolor='#E6E6E6',color='#EE6666 .color value can be rgb in hexadecimal form
For x and y label below code can be written
plt.xlabel('Value')
plt.ylabel('Frequency')
For future use we have to save the plot.Tosave any plot savefig() method is used.plotscan be
saved like pdf,svg,png,jpgfile formats.
plt.savefig('line_plot.pdf')
plt.savefig('line_plot.svg')
plt.savefig('line_plot.png')
Parameter for saving plots .e.g.
plt.savefig('line_plot.jpg', dpi=300, quality=80, optimize=True, progressive=True)
Which Export Format to Use?
The export as vector-based SVG or PDF files is generally preferred over bitmap-based PNG or JPG
files as they are richer formats, usually providing higher quality plots along with smaller file sizes
1. Consider the following program and answer any four question from (i) to (v) :
Ans: (d)
Ans: (a)
(v) Choose the statement to be place at Line7 of the above code .
(a) Plt.print() (b) plt.show()
Ans: (b)
2. If you are given to plot a histogram using numpy array as per the code given below then
answer any of four question from (i) to (v)
import numpy as np
ax.hist(a, bins=[0,10,20,30,40])
ax._____ (‘Histogram’)
ax.set_xticks ([0,10,20,30,40, ])
ax.set_xlabel(‘Percentage’)
ax._______ (‘Students’)
______
Ans: (c)
Ans: (a)
Ans: plt.show()
3. Consider the following case and answer the from (i) to (v)
import …………. as pd
import matplotlib. _____ as plt
data= {‘Name’ : [‘Karan’, ‘Adi’, ‘Abhinav’, ‘Kirti’, ‘Rahul’ ],
‘Height’ : [60,61,63,65,61],
‘Weight’ : [47,89,52,58,50,47]}
df=pd. _________ (data)
df._____ (Kind =’hist’, edgecolor = ‘Green’, linewidth =2, linestyle=’:’ , fill= False)
_____________
Ans: (c)plot
A. Data Visualization is used to communicate information clearly and efficiently to users by the
usage of information graphics such as tables and charts.
B. Data Visualization helps users in analyzing a large amount of data in a simpler way.
C. Data Visualization makes complex data more accessible, understandable, and usable.
D. All of the above
Ans : D
2. Which method is used to save the output of pyplot in the form of image file ?
A. savefig(‘filename’)
B. save_fig(‘filename)
C. save_figure(‘filename’)
D. save_img(‘filename’)
Answer : A
3. Data visualization is also an element of the broader _____________.
Answer : B
Answer: D
A. Politics
B. Sales and marketing
C. Healthcare
D. All of the above
Answer: D
Ans : A
Ans : C
Explanation: It can be distracting : if the visual data is distorted or excessively used.
8. Which one of the following is most basic and commonly used techniques?
A. Line charts
B. Scatter plots
C. Population pyramids
D. Area charts
Answer: A
Explanation: Line charts. This is one of the most basic and common techniques used. Line charts
display how variables can change over time.
A. matplotlib.pyplot
B. matplotlib.pip
C. matplotlib.numpy
D. matplotlib.plt
ANS: A
10. Observe the output figure. Identify the coding for obtaining this output.
plt.plot([1,2,3],[4,5,1])
plt.show()
plt.plot([1,2],[4,5])
plt.show()
plt.plot([2,3],[5,1])
plt.show()
D. import matplotlib.pyplot as plt
plt.plot([1,3],[4,1])
plt.show()
ANS: A
12. Identify the right type of chart using the following hints.
Hint 1: This chart is often used to visualize a trend in data over intervals of time.
A. Line chart
B. Bar chart
C. Pie chart
D. Scatter plot
ANS: A
13. Which of the following method will be add inside the file to display plot?
A. show()
B. display()
C.plot()
D.execute()
ANS: show()
A. horizontal_bar()
B. barh()
C. hbar()
D. bar()
ANS: C
A. his()
B. hist()
C. Hist()
D.histogram()
ANS: B
UNIT – 4 SOCIETAL IMPACTS
Societal impacts
In the past few decades there has been a revolution in computing and communications, and all
indications are that technological progress and use of information technology will continue at a
rapid pace. Accompanying and supporting the dramatic increases in the power and use of new
information technologies has been the declining cost of communications as a result of both
technological improvements and increased competition. According to Moore’s law the processing
power of microchips is doubling every 18 months. These advances present many significant
opportunities but also pose major challenges. Today, innovations in information technology are
having wide-ranging effects across numerous domains of society, and policy makers are acting on
issues involving economic productivity, intellectual property rights, privacy protection, and
affordability of and access to information. Choices made now will have long lasting consequences,
and attention must be paid to their social and economic impacts. One of the most significant
outcomes of the progress of information technology is probably electronic commerce over the
Internet, a new way of conducting business. Though only a few years old, it may radically alter
economic activities and the social environment. Already, it affects such large sectors as
communications, finance and retail trade and might expand to areas such as education and health
services. It implies the seamless application of information and communication technology along
the entire value chain of a business that is conducted electronically. The following sections will
focus on the impacts of information technology and electronic commerce on business models,
commerce, market structure, workplace, labour market, education, private life and society as a
whole.
Digital Footprint
A digital footprint is data that is left behind when users have been online. There are two types of
digital footprints which are passive and active. A passive footprint is made when information is
collected from the user without the person knowing this is happening. An active digital footprint
is where the user has deliberately shared information about themselves either by using social
media sites or by using websites.
An example of a passive digital footprint would be where a user has been online and information
has been stored on an online database. This can include where they came from, when the
footprint was created and a user IP address. A footprint can also be analysed offline and can be
stored in files which an administrator can access. These would include information on what that
machine might have been used for, but not who had performed the actions.
An example of an active digital footprint is where a user might have logged into a site when editing
or making comments such as on an online forum or a social media site. The registered name or
profile can be linked to the posts that have been made and it is surprisingly easy to find out a lot
about a person from the trails you leave behind.
Net and Communication Etiquettes
1. Be respectful.
2. Be aware of how your comments might be read:
3. Be careful with humour and sarcasm
4. Think about who can see what you have shared.
5. Remember to check friend requests and group invites before accepting them.
6. Take time to have a read of the rules of conduct/ community standards.
7. Be forgiving.
Data Protection
Data protection is a set of strategies and processes you can use to secure the privacy, availability,
and integrity of your data. It is sometimes also called data security or information privacy. A data
protection strategy is vital for any organization that collects, handles, or stores sensitive data.
Although both data protection and privacy are important and the two often come together, these
terms do not represent the same thing.
Data privacy is focused on defining who has access to data while data protection focuses on
applying those restrictions. Data privacy defines the policies that data protection tools and
processes employ.
Creating data privacy guidelines does not ensure that unauthorized users don’t have access.
Likewise, you can restrict access with data protections while still leaving sensitive data vulnerable.
Both are needed to ensure that data remains secure.
Another important distinction between privacy and protection is who is typically in control. For
privacy, users can often control how much of their data is shared and with whom. For protection,
it is up to the companies handling data to ensure that it remains private. Compliance regulations
reflect this difference and are created to help ensure that users’ privacy requests are enacted by
companies.
Data Protection Technologies and Practices that Can Help You Protect User Data
When it comes to protecting your data, there are many storage and management options you
can choose from. Solutions can help you restrict access, monitor activity, and respond to threats.
Here are some of the most commonly used practices and technologies:
1. Data loss prevention (DLP)—a set of strategies and tools that you can use to prevent data from
being stolen, lost, or accidentally deleted. Data loss prevention solutions often include several
tools to protect against and recover from data loss.
2. Storage with built-in data protection—modern storage equipment provides built-in disk
clustering and redundancy. For example, Cloudian’s Hyperstore provides up to 14 nines of
durability, low cost enabling storage of large volumes of data, and fast access for minimal RTO /
RPO.
3. Firewalls—utilities that enable you to monitor and filter network traffic. You can use firewalls to
ensure that only authorized users are allowed to access or transfer data.
4. Authentication and authorization—controls that help you verify credentials and assure that user
privileges are applied correctly. These measures are typically used as part of an identity and
access management (IAM) solution and in combination with role-based access controls (RBAC).
5. Encryption—alters data content according to an algorithm that can only be reversed with the
right encryption key. Encryption protects your data from unauthorized access even if data is
stolen by making it unreadable. Learn more in our article: Data Encryption: An Introduction.
6. Endpoint protection—protects gateways to your network, including ports, routers, and
connected devices. Endpoint protection software typically enables you to monitor your network
perimeter and to filter traffic as needed.
7. Data erasure—limits liability by deleting data that is no longer needed. This can be done after
data is processed and analyzed or periodically when data is no longer relevant. Erasing
unnecessary data is a requirement of many compliance regulations, such as GDPR. For more
information about GDPR, check out our guide: GDPR Data Protection.
Intellectual Property
It refers to creations of the intellect used in commerce:
Inventions
Literary and Artistic work
Symbols
Names Images and designs
Copyright
It is a legal concept, enacted by most governments giving creator of original work exclusive
rights to it, usually for a limited period.
Plagiarism
It is stealing someone’s intellectual work and representing it as your own work without citing
the source of information.
Copying someone’s work and then passing it off as one’s own
Act of stealing
Copying information and not giving the author credit for it
Copying programs written by other programmers and claiming them as your own
Involves lying, cheating, theft and dishonesty
Licensing:
Software Licensing is the legal right to run or the privilege gives to you by a company to access
their application or program or software.
For example:
When we purchase for proprietary software such as Windows OS, then we must have noticed
that it comes with a license agreement which is to be read first and to be agreed upon for the
successful installation and usage of the software.
1. By using licensed software, you are able to contribute to the further development of the
program you are using.
2. It comes with the outright support not found in “pirated” software.
The freedom to run the program as you wishes, for any purpose (freedom 0).
The freedom to study how the program works and change it so it does your computing as you
wish (freedom 1). Access to the source code is a precondition for this.
The freedom to redistribute copies so you can help others (freedom 2).
The freedom to distribute copies of your modified versions to others (freedom 3). By doing this
you can give the whole community a chance to benefit from your changes. Access to the source
code is a precondition for this.
Q1. Aniruddha is studying the concepts of digital footprints. Help him to clarify the concepts of
digital footprints.
a. Digital data
b. Plagiarism
c. Digital tattoos
d. Digital print
(iii) Whenever we surf the Internet using smartphones we leave a trail of data reflecting the
activities performed by us online, which is our ___________
a. Digital footprint
b. Digital activities
c. Online handprint
d. Internet activities
a. 1
b. 2
c. 3
d. 4
Q2. Pragya is a student of class XII. She is learning about safe internet surfing. Help him to understand
the concepts of digital footprint.
(ii) Which of the following activity is an example of leaving Active digital footprints?
a. Surfing internet
b. Visiting a website
c. Sending an email to friend
d. None of the above
(iii) The digital data trail we leave online intentionally is called _____
(iv) The digital data trail we leave online unintentionally is called _____
(ii) _______ is a person who deliberately sows discord on the Internet by starting quarrels or
upsetting people, by posting inflammatory or off topic messages in an online community.
a. Netizen
b. Digital Citizen
c. Internet troll
d. None of the above
(iii) Online posting of rumours, giving threats online, posting the victim’s personal information,
comments aimed to publicly ridicule a victim is termed as __________
a. Cyber bullying
b. Cyber crime
c. Cyber insult
d. All of the above
a. Be Ethical
b. Be Respectful
c. Be Responsible
d. All of the above
Answer:- (i)- (ii)- (iii)- (iv)- (v)-
Q4. Amit is studying about data protection. Help him to understand following concepts.
Intellectual Property.
a. copyright
b. patent
c. registered trademark
d. All of the above
(ii) The ____________ include right to copy (reproduce) a work, right to distribute copies of the
work to the public, and right to publicly display or perform the work.
a. Copyright
b. Patent
c. Create right
d. None of the above
(iii) A ______________ provide an exclusive right to prevent others from using, selling, or
distributing the protected invention
a. copyright
b. trademark
c. patent
d. All of the above
(iv) The name and logo of the software will be protected by ___________
a. copyright
b. patent
c. registered trademark
d. None of the above
a. copyright
b. patent
c. registered trademark
d. None of the above
Answer:- (i)- (ii)- (iii)- (iv)- (v)-
Q5. Ravi is studying about different types of licences given creative work, software etc. He is
also learning by free and open source software. Help him to clarify his doubts.
(i) A ____________ is a type of contract between the creators of an original work permitting
someone to use their work, generally for some price.
a. Agreement
b. License
c. Patent
d. Copyright
(ii) Presenting someone else’s idea or work as one’s own idea or work is called ________
a. Plagiarism
b. Copyright infringement
c. Patent infringement
d. None of the above
a. Creative Commons
b. Carbon copy
c. Creative Comments
d. Creative Culture
a. software
b. websites
c. literature
d. music
Plagiarisms
It is presenting someone else's work in form of words, views, ideas, images, sounds or
the creative expression and performance as your own work in following ways:-
i. Whether it is an ideas or either published or unpublished material;
ii. Whether in hard copy manuscript, design or softcopy or electronic form;
iii. Whether with or without consent of the actual owner:
iv. It can be done by incorporating it into your work without full
acknowledgement.
It is an offence under IT Act - The Patents Act, 1970; The Trade Marks Act, 1999
Licensing is the process by which the creator agrees to allow a third-party to use that
work product for specific purposes for an agreed upon fee.
Copyright basically means the right to make copies. A copyright is a legal arrangement or
procedure that prevents a third party from using a creator's work.
There should be no copyright violation during uploading media like audio, video or
images and creating content we should not use any material created by others without
their consent.
We should always try to make our own content or some time use loyalty free media
having creative commons free license to reuse them.
In India Patents Act of 1970 came into implement and in 2003 as Patent Rules came into
force then after in 2016 Patent Amendment Rules set out the law concerning patents.
Question 1:Namita has recently shifted to new city and new school. She does not know many
people in her new city and school. But all of a student, someone is posting negative, demeaning
comments on her social networking profile, school site’s forum etc.
She is also getting repeated mails from unknown people. Every time she goes online, she finds
someone chasing her online.
c)The act of fraudulently acquiring someone’s personal and private information, such as
online account names, login information and passwords is called as __________.
i. Phishing
ii. Fraud
iii. Scam
iv. Plagiarism
d) Namita needs to protect her personal information or data from unintentional and
intentional attacks and disclosure which is termed as ____________.
i.Digital right
ii. Copyright
iii. Privacy
iv. Intellectual property
e) A set of moral principles that governs the behaviour of a group or individual and
regulates the use of computers.
i.Copyright
ii.Computer ethics
iii.Property rights
iv.Privacy law
Solution:
a) i. Namita has become a victim of cyber bullying and cyber stalking.
b) iv. She must immediately bring it to the notice of her parents and
school authorities. And she must report this cybercrime to local police with
the help of her parents.
c) i. Phishing
d) iii. Privacy
e) ii. Computer Ethics
Question 2.
a) Ambika has been given a task of writing a poem for a reputed national magazine.
She surfs the internet and downloads a poem from another author. She then submits
it for the magazine as her work. What sort of crime has she committed?
i) Cyber bullying
ii) Plagiarism
iii) Phishing
iv) Pharming
b) I can keep you signed in. I can remember your site preferences. I can give you
locally relevant content. Who am I?
i) Cookies
ii) Trails
iii) History
iv) Ghost
. d) After practicals, Ambika left the computer laboratory but forgot to sign off from
her email account. Later, her classmate Revaan started using the same computer.
She is now logged in as Ambika. He sends inflammatory email messages to few of
his classmates using Ambika’s email account. Revaan’s activity is an example of
which of the following cyber crime? Justify your answer.
i) Hacking
ii) Identity theft
iii) Cyber bullying
iv) Plagiarism
e) Ambika found a crumpled paper under her desk. She picked it up and opened
it. It contained some text which was struck off thrice. But she could still figure out
easily that the struck off text was the email ID and password of Garvit, her
classmate. What is ethically correct for Ambika to do?
i) Inform Garvit so that he may change his password.
ii) Give the password of Garvit’s email ID to all other classmates.
iii) Use Garvit’s password to access his account.
iv) None of the above
Solution:
a) ii) Plagiarism
b) i) Cookies
c) ii) Phishing
d) ii) Identity theft
e) i) Inform Garvit so that he may change his password.
Question 3: a) Nitish received an email warning him of closure of his bank accounts if he
did not update his banking information as soon as possible. He clicked the
link in the email and entered his banking information. Next he got to know
that he was duped. This is an example of __________ .
i. Online Fraud
ii. Identity Theft
iii. Phishing
iv.Plagarism
b) Someone steals Nitish’s personal information to commit theft or fraud, it
is called ____________
i.Online Fraud
ii. Identity Theft
iii. Phishing
iv.Plagarism
c) Nitish is receiving Unsolicited commercial emails is known as …………..?
i.Spam
ii.Malware
iii.Virus
iv. Worms
d) Nitish’s Online personal account, personal website are the examples of?
i. Digital wallet
ii. Digital property
iii.Digital certificate
iv.Digital signature
b) A person complains that his/her debit/credit card is safe with him still
somebody has done shopping /ATM transaction on this card.
i. Identity theft
ii. Bank Fraud
iii. Cyber theft
iv. Cyber Crime
c) A person complains that somebody has created a fake profile of Facebook
and defaming his/her character with abusive comments and pictures.
i. Cyber bullying
ii. Cyber stalking
iii. Cyber theft
iv. Cyber Crime
a) ii.Bank Fraud
b) i.Identity theft
c) ii.Cyber Stalking
d) ii.Online Fraud
e) ii.Firewall
i.Firewall
ii.antivirus
iii.Cookies.
iv.Text files
e) The practice of taking confidential information from you through and original
looking site and URL is known as _______________
i)Spamming
ii.Drafts
iii.Phishing
iv.Identity theft
Solution: a)iii.Digital Footprints
b)iii.Copyright
c)i.Spam
d)i.Firewall
e)iii.Phishing
ASSERTION AND REASONING BASED QUESTIONS
1. Assertion :( A) Intellectual Property Rights are the rights of the owner of information to
decide how much information is to be exchanged.
Reason: (R) The owner has the right to protect his/her intellectual property.
5. Assertion: ( A) Scams committed over the Internet are called Online scams.
Reason:( R) It is a fraudulent business practice that extracts money from an
unsuspecting,ignorant person called a Scam.
E-Waste Hazards
Mostly all electronic waste comprises of toxic chemicalssuch as lead, beryllium,
mercury etc.
Improper disposing of gadgets and devices increases the amount of these toxic
chemicals thus contaminated the soil, causing air and water pollution.
The contaminated water which is highly polluted it thusmaking it harmful for drinking
purposes.
Improper e-waste recycling, such as by open burning and acid baths creates hazardous
and toxic compounds like- dioxins, furans and acids.
Skin disease.
Multi ailments.
Skin problems
E-Waste Management
E-waste management requires proper recycling and recovery of the disposed material.
The recycling and recovery process includes following steps-
1. Dismantling:- removal of parts containing valuable items such as- copper, silver,
gold, steel and removalof parts containing dangerous substance like- mercury, lead,
Beryllium etc.
3. Refurbishment and reuse: it means used electrical and electronic items that can be
easily remodel to make it’s to reuse.
1. Neck strain
2. Vision Problem
3. Sense of isolation
4. Sleeping disorder
5. Stress
6. Loss of attention
7. Problem in social relationships of individuals.
8. Computer anxiety
9. Internet addiction etc.
One should learn how to use these technologies without experiencing any
problem rather than avoiding using them.
Some of the users of computer technologies are not even aware of their health-
related problems that they have.
Q1: Nisha’s computer and smartphone is not working properly, computer expert told her that
now it won’t repair so she is in dilemma where to dispose these electronic items now help Nisha
to understand the concept of e waste management & help Nisha to answer these questions.
1. E-waste stands for ______
a. Electrical waste
b. Electronic waste
c. Electricity waste
d. E-waste
Answer
Ans. b. Electronic waste
a. discarded computers
b. damaged printers
c. useless CDs
d. All of the above
Answer
Ans. d. All of the above
Answer
a. Lithium
Answer
b. When waste increase mortality
5. Nisha’s PC is no longer functional .How would you suggest to dispose of this PC.
Q2 Jatin UPS is no longer functional. What issue can de caused if we throw the UPS without
following proper e waste management protocols, help jatin to follow the proper protocol.
1. What happen if we throw acid batteries in empty landfills? What kind of pollution it can
cause.
a. Can cause Soil and water pollution
b. It will harm environment
c. Can cause Noise and Air pollution
d. It will not harm environment
Answer
a. True
b. False
Answer
a. True
a. True
b. False
Answer
b. False
5. e-waste is responsible for air, water and land pollution.(T/F)
a. True
b. False
Answer
a. True
Q3. Radhika attended the lecture on E waste management now her friends call her asking
question help radhika to answer the questions.
a. Reduce
b. Reuse
c. Recycle
d. All of the above
Answer
d. All of the above
2. The process of re-selling old electronic goods at lower prices is called ____
a. refurbishing
b. recycle
c. reuse
d. reduce
Answer
a. refurbishing
3. What are the things that we should not do while disposing e waste .
a. We should not dump them
b. We should not burn them
c. All of above
Answer
c. All of the above
4. What are the items that fall under e waste .
a. Mobile phones
b. Acid Batteries
c. All of above
d. None of these
Answer
A,b
Answer
Ans. i. Certified E Waste , Donate.
CONTENT DEVELOPMENT TEAM