0% found this document useful (0 votes)
241 views185 pages

Ip Study Material

Uploaded by

ADITYA INTERIOR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
241 views185 pages

Ip Study Material

Uploaded by

ADITYA INTERIOR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 185

2022-2023

के ीय िव ालय संगठन, एनाकुलम े


KENDRIYA VIDYALAYA SANGATHAN
ERNAKULAM REGION

INFORMATICS PRACTICES (065)


CBSE Curriculum

Student Support Material


के ीय िव ालय संगठन, एनाकुलम े
KENDRIYA VIDYALAYA SANGATHAN
ERNAKULAM REGION

Informatics Practices(065)

Class XII

STUDENT SUPPORT MATERIAL

2022-2023
CHIEF PATRON

Mr R Senthil Kumar
Deputy Commissioner

PATRON

Mrs Deepti Nair


Assistant Commissioner

IN-CHARGE

Mr. Alex Jose


I/C Principal, K V Konni
4
CONTENTS PREPARED & REVIEWED BY

SLNO TEACHER NAME NAME OF KV

K V CRPF PALLIPURAM
1 Mrs. AMBILY KRISHNAN CO-ORDINATOR

2 Mrs MANJU N K V THRISSUR

3 Mrs. SUJA P NAIR K V ERNAKULAM

4 Mr. P C SAJESH K V MALAPPURAM

5 Mrs. HEMA R K V ADOOR (SHIFT 2)

6 Mrs. RESHMA SURENDRAN K V No.2 KOCHI

7 Mr. SOJU S K V INS DRONACHARYA

8 Mrs. SUNI ABRAHAM K V RB, KOTTAYAM

9 Mrs. SINI ALEX K V PATTOM (SHIFT 1)

10 Mrs. ANEESA N ALI K V NO. 1 CALICUT

11 Mrs. DEEPA P R K V SAP PEROORKADA

5
“Success is no accident. It is hard work,
perseverance, learning, studying, sacrifice
and most of all, love of what you are doing
or learning to do.”

Pelé, Brazilian pro footballer

6
INDEX
Sl. No TOPIC PAGE
No:
1 Data Handling Using Pandas 8
Series 14
Data Frames 24
2 Importing/Exporting CSV Files 47
3 Visualisation 54
4 Database – SQL 71
5 Computer Networking 90
6 Societal Impacts 113
7 Sample Question Papers 129
SQP 1 130
SQP 2 143
SQP 3 157
SQP 4 (CBSE) 170
8. Other References 185

7
Index
UNIT 1
Data Handling Using Pandas
Python module- A python module is a python script file(.py file) containing
variables, python classes, functions, statements etc.
Python Library/package- A Python library is a collection of modules that together cater
to a specific type of need or application. The advantage of using libraries is that we can
directly use functions/methods for performing specific type of application instead of rewriting
the code for that particular use. They are used by using the import command as-
import libraryname
at the top of the python code/script file.
Some examples of Python Libraries-
1. Python standard library-It is a collection of library which is normally distributed
along with Python installation. Some of them are-
a. math module- provides mathematical functions
b. random module- provides functions for generating pseudo-random numbers.
c. statistics module- provides statistical functions
2. Numpy (Numerical Python) library- It provides functions for working with large
multi-dimensional arrays(ndarrays) and matrices. NumPy provides a large set of
mathematical functions that can operate quickly on the entries of the ndarray
without the need of loops.
3. Pandas (PANel + DAta) library- Pandas is a fast, powerful, flexible and easy to use
open source data analysis and manipulation tool. Pandas is built on top of NumPy,
relying on ndarrayand its fast and efficient array based mathematical functions.
4. Matplotlib library- It provides functions for plotting and drawing graphs.

Data Structure- Data structure is the arrangement of data in such a way that
permits efficient access and modification.
Pandas Data Structures- Pandas offers the following data structures-
a) Series - 1D array
b) DataFrame - 2D array
Series- Series is a one-dimensional array with homogeneous data.
Index/Label
0 1 2 3 4
abc def ghi Jkl mno 1D Data values
Key features of Series-

8
 A Series has only one dimension, i.e. one axis
 Each element of the Series can be associated with an index/label that can be used
to access the data value. By default the index starts with 0,1,2,3… but it can be set
to any other data type also.
 Series is data mutable i.e. the data values can be changed in-place in memory
 Series is size immutable i.e. once a series object is created in memory with a fixed
number of elements, then the number of elements cannot be changed in place.
Although the series object can be assigned a different set of values it will refer to a
different location in memory.
 All the elements of the Series are homogenous data i.e. their data type is the same. For
example.

0 1 2 3 4
223 367 456 339 927
all data is of int type

a b c de fg
1 def 10.5 Jkl True

all data is of object type

Creating a Series- A series object can be created by calling the Series() method in the
following ways-
a) Create an empty Series- A Series object not containing any elements is an
empty Series. It can be created as follows-
import pandas as pd
s1=pd.Series() print(s1)

o/p-
Series([], dtype: float64)

b) Create a series from array without index- A numpy 1D array can be used
to create a Series object as shown below. The default index is 0, 1, 2, …

import pandas as pd o/p-


import numpy as np 0 hello
a1=np.array(['hello', 'world', 'good', np.NaN]) 1 world
s1=pd.Series(a1) 2 good
print(s1) 3 nan
dtype: object

9
c) Create a series from array with index- The default index for a Series
object can be changed and specified by the programmer by using the index
parameter and enclosing the index in square brackets. The number of elements of
the array must match the number of index specified otherwise python gives an
error.
#Creating a Series object using numpy array and specifying index
import pandas as pd
import numpy as np
a1=np.array(['hello', 'world', 'good', 'morning'])
s1=pd.Series(a1, index=[101, 111, 121, 131])
print(s1)

o/p-
101 hello
111 world
121 good
131 morning

dtype: object

d) Create a Series from dictionary- Each element of the dictionary contains a


key:value pair. The key of the dictionary becomes the index of the Series object
and the value of the dictionary becomes the data.
#4 Creating a Series object from dictionary
import pandas as pd
d={101:'hello', 111:'world', 121:'good', 131:'morning'} s1=pd.Series(d)
print(s1)

o/p-
101 hello
111 world
121 good
131 morning

dtype: object

a) Create a Series from dictionary, reordering the index- When we are


creating a Series object from a dictionary then we can specify which all elements of
the dictionary, we want to include in the Series object and in which order by
specifying the index argument while calling the Series() method.
 If any key of the dictionary is missing in the index argument, then that
element is not added to the Series object.

10
 If the index argument contains a key not present in the dictionary then a
value of NaN is assigned to that particular index.
 The order in which the index arguments are specified determines the order
of the elements in the Series object.
#5 Creating a Series object from dictionary reordering
the index
import pandas as pd

d={101:'hello', 111:'world', 121:'good', 131:'morning'}


s1=pd.Series(d, index=[131, 111, 121, 199])
print(s1)

o/p-
131 morning
111 world
121 good
199 NaN

dtype: object

Create a Series from a scalar value- A Series object can be created from a single value
i.e. a scalar value and that scalar value can be repeated many times by specifying the index
arguments that many number of times.
#6 Creating a Series object from scalar value
import pandas as pd

s1=pd.Series(7, index=[101, 111, 121]) print(s1)

o/p-
101 7
111 7
121 7
dtype: int64

a) Create a Series from a List- A Series object can be created from a list as shown
below.

#7 Creating a Series object from list


import pandas as pd L=['abc', 'def', 'ghi', 'jkl']s1=pd.Series(L)
print(s1)

o/p-
0 abc
1 def ghi
2 jkl
3
dtype: object
11
b) Create a Series from a Numpy Array (using various array creation methods) -
A Series object can be created from a numpy array as shown below. All the
methods of numpy array creation can be used to create a Series object.
#7a Creating a Series object from list
import pandas as pd
import numpy as np

#a Create an array consisting of elements of a list [2,4,7,10,


. 13.5, 20.4]
a1=np.array([2,4,7,10, 13.5, 20.4])
s1=pd.Series(a1)
print('s1=', s1)

#b Create an array consisting of ten


. zeros.
a2=np.zeros(10)
s2=pd.Series(a2, index=range(101,
111)) print('s2=', s2)

#c Create an array consisting of five


. ones.
a3=np.ones(5)
s3=pd.Series(a3)
print('s3=', s3)

#d.Create an array consisting of the elements from


1.1, 1.2, 1.3,1.4, 1.5, 1.6, 1.7
a4=np.arange(1.1,1.8,0.1)
s4=pd.Series(a4) print('s4=', s4)

#e. Create an array of 10 elements which are linearly spaced between 1 and 10
(both inclusive)
a5=np.linspace(1,10,4)
s5=pd.Series(a5) print('s5=', s5)

#f. Create an array containing each of the characters of the word ‘helloworld’
a6=np.fromiter('helloworld', dtype='U1')
s6=pd.Series(a6) print('s6=', s6)

o/p:
s1= 0 2.0
1 4.0
2 7.0
3 10.0
4 13.5
5 20.4
dtype: float64

12
s2= 101 0.0
102 0.0
103 0.0
104 0.0
105 0.0
106 0.0
107 0.0
108 0.0
109 0.0
110 0.0
dtype: float64
s3= 0 1.0
1 1.0
2 1.0
3 1.0
4 1.0
dtype: float64
s4= 0 1.1
1 1.2
2 1.3
3 1.4
4 1.5
5 1.6
6 1.7
dtype: float64
s5= 01.0
1 4.0
2 2 7.0
3 3 10.0
dtype: float64
s6= 0 h
1 e
2 l
3 l
4 o
5 w
6 o
7 r
8 l
9 d
dtype: object

13
Index
SERIES : Operations on Series objects-
1. Accessing elements of a Series object
The elements of a series object can be accessed using different methods as shown below-
a) Using the indexing operator []
The square brackets [] can be used to access a data value stored in a
Series object. The index of the element must be entered within the square
brackets. If the index is a string then the index must be written in quotes. If
the index is a number then the index must be written without the quotes.
Attempting to use an index which does not exist leads to error.

#8 Accessing elements of Series using index


import pandas as pd

d={101:'hello', 'abc':'world', 121:'good', 131:'morning'} s=pd.Series(d)


print(s['abc']) print(s[131])

o/p- world
morning

a) Using the loc property of the Series object


The loc property of a Series object can be used to access a range of data
values using the label/index name inside [] brackets in the following ways:
1. A single index can be passed to the loc property. This will return back a single
value.
2. A list of indexes can be passed. This will return back a Series object
containing the multiple values
3. A slice notation using labels/index such as startindex:stopindex. Here
contrary to the slice notation the ending index value also is included in the
result.
4. A boolean array of the same length as the axis being sliced, e.g. [True, False,
True].

b) Using the iloc property of the Series object


The iloc property of a Series object can be used to access a range of data values
using the
index position numbers inside [] brackets in the following ways:
5. A single int can be passed to the iloc property. This will return back a single value.
6. A list of int representing index position numbers can be passed. This will
return back a Series object containing the multiple values
7. A slice notation using index position numbers can be passed. The data values
14
at the slice position numbers will the included in the returned Series object
8. A boolean array of the same length as the axis being sliced, e.g. [True, False,
True].

2. Accessing the top elements of a Series object


The head() method can be used to return back the top elements of a Series
object. This function returns back another Series object. If no parameter is passed to
the head() method it returns back the top 5 elements. If an integer parameter (say n) is
passed to the head() method, then the top n elements of the Series object is returned
back. The index of the respective elements is returned as it was in the original object.
#14 Accessing the top elements of a Series object
import pandas as pd

L=[101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 201, 211]
s=pd.Series(L)

x=s.head()
print('x=\n', x)
y=s.head(3)
print('y=\n', y)

o/p:
x=
0 101
1 111
2 121
3 131
4 141
dtype: int64 y=
0 101
1 111
2 121
dtype: int64

1. Accessing the bottom elements of a Series object


The tail() method can be used to return back the bottom elements of a Series object.
This function returns back another Series object. If no parameter is passed to the tail()
method it returns back the bottom 5 elements. If an integer parameter (say n) is passed
to the tail() method, then the bottom n elements of the Series object is returned back.
The index of the respective elements is returned as it was in the original object.

#15 Accessing the bottom elements of a Series object


t import pandas as pd

L=[101, 111, 121, 131, 141, 151, 161, 171, 181, 191, 201, 211]
s=pd.Series(L)
x=s.tail()
15
print('x=\n', x)
y=s.tail(3)
print('y=\n', y)

o/p: y=
x= 9 191
7 171 10 201
8 181 11 211
9 191 dtype: int64
10 201
11 211
dtype: int64

3. Indexing/Slicing a Series object-


The index [] operator can be used to perform indexing and slicing operations on a Series
object. The index[] operator can accept either-
a) Index/labels
b) Integer index positions

a) Using the index operator with labels-


The index operator can be used in the following ways-
i) Using a single label inside the square brackets- Using a single label/index
inside the square brackets will return only the corresponding element referred to by
that label/index.
# 16 indexing a Series object single label
import pandas as pd

d={'a':101, 'b':102, 'c':103, 'd':104, 'e':105, 'f':106}


s=pd.Series(d)
t=s['b']
print(t)

o/p:
102

Using multiple labels- We can pass multiple labels in any order that is present in the
Series object. The multiple labels must be passed as a list i.e. the multiple labels must be
separated by commas and enclosed in double square brackets. Passing a label is passed
that is not present in the Series object, should be avoided as it right now gives NaN as the
value but in future will be considered as an error by Python.
# 17 indexing a Series object
multiple labels import pandas as pd

d={'a':101, 'b':102, 'c':103, 'd':104, 'e':105, 'f':106}


s=pd.Serie
s(d)
16
u=s[['b', 'a',
'f']]
print(u)

o/p:
b 102
a 101
f 106
dtype: int64
ii) Using slice notation startlabel:endlabel- Inside the index operator we can pass
startlabel:endlabel. Here contrary to the slice concept all the items from startlabel
values till the endlabel values including the endlabel values is returned back.
# 18 indexing a Series object using startlabel:endlabel
import pandas as pd

d={'a':101, 'b':102, 'c':103, 'd':104, 'e':105, 'f':106}


s=pd.Series(d)
u=s['b': 'e']
print(u)

o/p:
b 102
c 103
d 104
e 105

dtype: int64

b) Slicing a Series object using Integer Index positions-


The concept of slicing a Series object is similar to that of slicing python lists, strings etc.
Even though the data type of the labels can be anything each element of the Series object
is associated with two integer numbers:
 In forward indexing method the elements are numbered from 0,1,2,3, … with 0
being assigned to the first element, 1 being assigned to the second element and so
on.
 In backward indexing method the elements are numbered from -1,-2, -3, … with -1
being assigned to the last element, -2 being assigned to the second last element
and so on.

For example consider the following Series object-


d={'a':101, 'b':102, 'c':103, 'd':104, 'e':105, 'f':106}
s=pd.Series(d)
The Series object is having the following integer index positions-

17
forward
indexing---> 0 1 2 3 4 5
a b c d e f
101 111 121 131 141 151
<-----backward
-6 -5 -4 -3 -2 -1 indexing
Slice concept-
The basic concept of slicing using integer index positions are common to Python object
such as strings, list, tuples, Series, Dataframe etc. Slice creates a new object using
elements of an existing object. It is created as: ExistingObjectName[start : stop : step]
where start, stop , step are integers

The basic rules of slice:


i. The slice generates index/integers from : start, start + step, start + step + step,
and so on. All the numbers generated must be less than the stop value when
step is positive.
ii. If step value is missing then by default is taken to be 1
iii. If start value is missing and step is positive then start value is by default taken as 0.
iv. If stop value is missing and step is positive then start value is by default taken to
mean till you reach the ending index(including the ending index)
v. A negative step value means the numbers are generated in backwards order i.e.
from - start, then start - step, then start -step -step and so on. All the numbers
generated in negative step must be greater than the stop value.
vi. If start value is missing and step is negative then start value takes default value -1
vii. If stop value is missing and step is negative then stop value is by default taken to be
till you reach the first element(including the 0 index element)

#16 Slicing a Series object o/p:


import pandas as pd x=
b 111
d={'a':101, 'b':111, 'c':121, 'd':131, 'e':141, 'f':151} d 131
s=pd.Series(d) f 151
dtype: int64
x=s[1: :2] y=
print('x=\n', x) f 151
e 141
y=s[-1: :-1] d 131
print('y=\n', y) c 121
b 111
z=s[1: -2: 2] a 101
print('z=\n', z) dtype: int64
z=
b 111
d 131
dtype: int64

18
QUESTION AND ANSWER SECTION
1 What will be the output of following code-
import pandas as pd
s1=pd.Series([1,2,2,7,’Sachin’,77.5])
print(s1.head())
print(s1.head(3))

Ans:

0 1
1 2
2 2
3 7
4 Sachin
dtype: object

0 1
1 2
2 2
dtype: object

2 In pandas, S is a series with the following result:


S=pd.Series([5,10,15,20,25])
The series object is automatically indexed as 0,1,2,3,4. Write a statement to
assign the series as a, b, c, d, e index explicitly.

Ans:
S=pd.Series([5,10,15,20,25],index=['a','b','c','d','e'])

3 Name any two attributes of Series in Python


Ans. Two attributes of Series in Python are :
1. index
2. values
4 Write the output of the following :
import numpy as num
import pandas as pd
arr=num.array([1,7,21])
S1 = pd.Series(arr)
print(S1)
Ans.
0 1
1 7
2 21
dtype: int32

19
5 Write the output of the following code :
import pandas as pd
S1 = pd.Series([31, 28, 31, 30, 31], index = ["Jan", "Feb", "Mar", "Apr", "May"])
print("-----------")
print(S1[1:3])
print("-----------")
print(S1[:5])
print("-----------")
print(S1[3:3])
print("-----------")
print(S1["Jan":"May"])
Ans.
-----------
Feb 28
Mar 31
dtype: int64
-----------
Jan 31
Feb 28
Mar 31
Apr 30
May 31
dtype: int64
-----------
Series([ ], dtype: int64)
-----------
Jan 31
Feb 28
Mar 31
Apr 30
May 31
dtype: int64
6 Differentiate between Pandas Series and NumPy Arrays
Ans. Differences are
Pandas Series NumPy Arrays

In NumPy Arrays we can not define


In series we can define our own labeled
our own labelled index to access
index to access elements of an array.
elements of an array

Series require more memory NumPy occupies lesser memory.

The elements can be indexed in The indexing starts with zero for the
descending order also. firstelement and the index is fixed

20
7 1. What do you mean by Pandas in Python?
Ans. PANDAS (PANel DAta) is a high-level data manipulation tool used for analyzing
data. Pandas library has a very rich set of functions.
1. Series
2. DataFrame
3. Panel
8 Name three data structures available in Pandas.
Ans. Three data structures available in Pandas are :
1. Series
2. DataFrame
3. Panel
9 Write the code in python to create an empty Series.
Ans.

import pandas as pd
S1 = pd.Series( )
print(S1)

OR

import pandas as pd
S1 = pd.Series( None)
print(S1)

OUTPUT : Series([ ], dtype: float64)

10 Define data structure in Python.


Ans. A data structure is a collection of data values and operations that can be applied to
that data.
11 What do you mean by Series in Python?
Ans. A Series is a one-dimensional array containing a sequence of values of any data
type (int, float, list, string, etc) which by default have numeric data labels (called index)
starting from zero. Example of a series containing names of students is given below:
Index Value
0 Arnab
1 Samridhi
2 Ramit
3 Divyam
4 Kritika

21
12 Write command to install pandas in python.
Ans. pip install pandas

13 Write the output of the following :


import pandas as pd
S1 = pd.Series(range(100, 150, 10), index=[x for x in "My name is Amit Gandhi".split()])
print(S1)
Ans.

My 100
name 110
is 120
Amit 130
Gandhi 140
dtype: int64
14 Write the output of the following :
import pandas as pd
L1=[1,"A",21]
S1 = pd.Series(data=2*L1)
print(S1)
Ans.

0 1
1 A
2 21
3 1
4 A
5 21
dtype: object

15 Which property of series return all the index value?


Ans. index property return all the index value
16 Write the output of the following :
import pandas as pd
S1 = pd.Series(range(1,15,3), index=[x for x in "super"])
print(S1)
Ans.

s 1
u 4
p 7
e 10
r 13
dtype: int64

22
17 Complete the code to get the required output :

import ______ as pd
________ = pd.Series([31, 28, 31], index = ["Jan", "Feb", "Mar"] )
print(S1["_______"])

OUTPUT :

28
Ans.
import pandas as pd
S1 = pd.Series([31,28,31], index = ["Jan","Feb","Mar"])
print(S1["Feb"])
18 Fill in the blank of given code, if the output is 71.

import pandas as pd
S1 = pd.Series([10, 20, 30, 40, 71,50])
print(S1[ __________ ])
Ans.
import pandas as pd
S1 = pd.Series([10, 20, 30, 40, 71,50])
print(S1[ 4 ])

19 Write a program to modify the value 5000 to 7000 in the following Series “S1”

A 25000
B 12000
C 8000
D 5000

Ans.
import pandas as pd
S1[3]=7000
print(S1)
20 Write a program to display only those values greater than 200 in the given Series “S1”

0 300
1 100
2 1200
3 1700

Ans.

import pandas as pd
S1 = pd.Series([300, 100, 1200, 1700])
print(S1[S1>200])

23
Index
DATA FRAMES
 DataFrame Data Structure
 It is two dimensional (tabular) heterogeneous data labeled array.
 It has two indices or two axes : a row index (axis=0) and a column index (axis=1)
 The row index is known as index and the column index is called the column name.
 The indices can be of any data type.
 It is both value mutable and size mutable.
 We can perform arithmetic operations on rows and columns.
 Creating and Displaying a DataFrame
To create a DataFrame object, we can use the syntax:
<dataframe object> = pandas.DataFrame( <a 2D datastructure> , [columns=<column
sequence>] , [index=<index sequence>] )
where the 2D data structure passed to it, contains the data values.
 Empty DataFrame
import pandas as pd
df=pd.DataFrame()
print(df)
 DataFrame from 2D dictionary
A 2D dictionary is a dictionary having items as (key : value) where value part is a data
structure of any type : a list, a series, a dictionary etc. But the value parts of all the keys
should have similar structure and equal lengths.
 Creating a DataFrame from 2D dictionary having values as lists:
dict1={'Students':['Neha','Maya','Reena'],
'Marks':[20,40,30],
'Sports':['Cricket', 'Football','Badminton']}
df1=pd.DataFrame(dict1)
print(df1)
 The keys of the dictionary has become columns.
 The columns are placed in sorted order.
 The index is assigned automatically (0 onwards).
We can specify our own index too by using the index argument.
df2=pd.DataFrame(dict1,index=['I','II','III'])
print(df2)
 The number of indexes given in the index
sequence must match the length of the
dictionary’s values, otherwise Python will
give error.

 Creating a DataFrame from 2D dictionary having values as Series objects.


 DataFrames are two dimensional representation of series.
smarks=pd.Series({'Neha':80,'Maya':90,'Reena':70})
sage=pd.Series({'Neha':25,'Maya':30,'Reena':29})
dict={'Marks':smarks,'Age':sage}
df3=pd.DataFrame(dict)

24
print(df3)
or
smarks=pd.Series([80,90,70],index=['Neha','Maya','Reena'])
sage=pd.Series([25,30,29],index=['Neha','Maya','Reena'])
dict={'Marks':smarks,'Age':sage}
df3=pd.DataFrame(dict)
print(df3)
 DataFrame object created has columns assigned from
the keys of the dictionary object and its index assigned from the indexes
of the Series object which are the values of the dictionary object.

 Creating a DataFrame from list of dictionaries


student=[{'Neha':50,'Manu':40},{'Neha':60,'Maya':45}]
df4=pd.DataFrame(student,index=['term1','term2'])
print(df4)
 NaN is automatically added in missing places.

 Selecting or Accessing Data


import pandas as pd
dict={'BS':[80,98,100,65,72],'ACC':[88,67,93,50,90],
'ECO':[100,75,89,40,96],'IP':[100,98,92,80,86]}
df5=pd.DataFrame(dict,index=['Ammu','Achu','Manu','Anu','Abu'])
print(df5)

 Selecting / Accessing a column


Syntax :
<dataframe object>[<column name>] Or <dataframe object>.<column name>
 In the dot notation make sure not to put any quotation marks around the
column name.
print(df5.BS)
or
print(df5['BS'])
 Selecting / Accessing multiple columns
Syntax :
<dataframe object>[[<column name>,<column name>,…….]]
 Columns appear in the order of column names given in
the list inside square brackets.
print(df5[['BS','IP']])

 Selecting / Accessing a subset from a DataFrame using Row/Column names


<dataframe object>.loc[<start row>:<end row>,<start column>:<end column>]
 To access a row:
<dataframe object>.loc[<row label>, : ]

25
 Make sure not to miss the colon after comma.

print(df5.loc['Ammu', :])

 To access multiple rows:


<dataframe object>.loc[<start row>:<end row> , : ]
 Python will return all rows falling between start
row and end row; along with start row and end
row.
print(df5.loc['Ammu':'Manu', : ])

 Make sure not to miss the colon after comma.

 To access selective columns:


<dataframe object>.loc[ : , <start column> : <end column>]
 Lists all columns falling between start and end column.

print(df5.loc[:,'ACC':'IP'])

 Make sure not to miss the colon before comma.

 To access range of columns from a range of rows:


<dataframe object>.loc[<start row> : <end row>,
<start column> : <end column>]
print(df5.loc['Manu':'Abu','ACC':'ECO'])

 Selecting / Accessing a subset from a DataFrame using


Row/Column numeric index/position
Sometimes our dataframe object does not contain row or column
labels or even we may not remember, then to extract subset from
dataframe we can use iloc.
<dataframe object>.iloc[<start row index> : <end row index>,
[<start column index> : <end column index>]
 When we use iloc, then end index is excluded.
print(df5.iloc[1:3,1:3])

 Selecting / Accessing individual value


(i) Either give name of row or numeric index in square bracket of column
name
<dataframe object>.<column>[<row name or row numeric index>]
print(df5.ACC['Achu']) 67
or
print(df5.ACC[1])
(ii) Using at or iat

26
<dataframe object>.at[<row label>,<column label>]
Or
<dataframeobject>.iat[<numeric row index>,
<numeric column index>]
print(df5.at['Achu','ACC']) 67
or
print(df5.iat[1,1])

 Assigning / Modifying Data Values in DataFrame


 To change or add a column
<dataframe object>[<column name>]=<new value>
 If the given column name does not exist in
dataframe then a new column with the name is
added.
df5['ENG']=60
print(df5)

 If you want to add a column that has different values for all its rows, then we
can assign the data values for each row of the column in the form of a list.
df5[‘ENG’]=[50,60,40,30,70]
 There are some other ways for adding a column to a database.
<dataframe object>.at[ : , <column name>]=value
Or
<dataframe object>.loc[ : ,<column name>]=value
df5.at[ : ,'ENG']=60
print(df5)
or
df5.loc[ : ,'ENG']=60
print(df5)

 To change or add a row


<dataframe object>.at[rowname , : ]=value
or
<dataframe object>.loc[rowname , : ]=value
df5.at['Sabu', : ]=50
print(df5)
or
df5.loc['Sabu', : ]=50
print(df5)
 If there is no row with such row label, then adds new row with this row label
and assigns given values to all its columns.

27
 To change or modify a single data
value
<dataframe object>.<column>[<row
label or row index>] = value
df5.BS['Ammu']=100
print(df5)
or
df5.BS[0]=100
print(df5)

 Deleting columns in DataFrame


 We can use del statement, to delete a column
del <dataframeobject>[<column name>]
e.g.: del df5[‘ENG’]
 We can use drop() also to delete a column. By default axis=0.
<dataframe object> = <dataframeobject>.drop([<columnname or index>],axis=1)
Or
<dataframe object> = <dataframeobject>.drop(columns=[<columnnames or
indices>])
df5=df5.drop([‘ECO’], axis =1)
df5=df5.drop(columns=['ECO','IP'])
 We can use pop() to delete a column. The deleted column will be returned as Series
object.
bstud=df5.pop(‘BS’)
print(bstud)
 Deleting rows in DataFrame
<dataframe object>=<dataframe object>.drop([index or sequence of index], axis=0)
df5=df5.drop(['Ammu','Achu'])
or
df5=df5.drop(index=['Ammu','Achu'])

Iterating over a DataFrame


 Using pandas.iterrows() Function
 The method <DF>.iterrows() views a dataframe
in the form of horizontal subset ie row-wise.
 Each horizontal subset is in the form of (row-
index, Series) where Series contains all
column values for that row –index.
 We can iterate over a Series object just as we
iterate over other sequences.
import pandas as pd
dict={'BS':[80,98],'ACC':[88,67]}
df5=pd.DataFrame(dict,index=['Ammu','Achu'])
print(df5,"\n")

for (row,rowseries) in df5.iterrows():


28
print("Row index:",row)
print("containing")
i=0
for val in rowseries:
print("At position ",i,":",val)
i=i+1
print()

 Using pandas.iteritems() Function


 The method <DF>.iteritem() views a dataframe in the
form of vertical subset ie column-wise.
 Each vertical subset is in the form of (col-index,
Series) where Series contains all row values for
that column index.
import pandas as pd
dict={'BS':[80,98],'ACC':[88,67]}
df5=pd.DataFrame(dict,index=['Ammu','Achu'])
print(df5,"\n")

for (column,columnseries) in df5.iteritems():


print("Column index:",column)
print("containing")
i=0
for val in columnseries:
print("At row ",i,":",val)
i=i+1
print()

 Head and Tail Functions


 head()
<DF>.head([n=5])
 To retrieve 5, top rows of a dataframe.
 We can change the number of rows by specifying value for n.
df5.head(5)
df5.head(2)
 tail()
 To retrieve 5, bottom rows of a dataframe.
 We can change the number of rows by specifying value for n.
df5.tail(5)
df5.tail(2)

 Renaming index / column labels

29
 rename() renames the existing index or column labels
in a dataframe/series.
 The old and new index/column labels are to be
provided in the form of a dictionary where keys are
the old indexes/row labels and the values are the
new names for the same.
Syntax:
<DF>.rename(index=None, columns=None, inplace=False)
where index and columns are dictionary like.
inplace, a boolean by default False (which returns a new dataframe with
renamed index/labels).
If True then changes are made in the current dataframe.
import pandas as pd
dict={'p_id':[101,102],'p_name':['Hard disk','Pen Drive']}
df=pd.DataFrame(dict)
print(df,"\n")
#df.rename(columns={'p_id':'Product_ID','p_name':'product_name'},inplace=True)
#or
df=df.rename(columns={'p_id':'Product_ID','p_name':'product_name'})
print(df)

 Columns can also be renamed by using the


columns attribute of dataframe.
import pandas as pd
dict={'p_id':[101,102],'p_name':['Hard disk','Pen Drive']}
df=pd.DataFrame(dict)
df.columns=['Product_ID','product_name']
print(df,"\n")

 Reindexing
 reindex() used to change the order of the rows or
columns in DataFrame/Series and returns
DataFrame/Series after changes.
Syntax:
<DF>.reindex(index=None, columns=None, fill_value=NaN)
df=df.reindex(columns=['product_name','Product_ID'])
print(df)
 If the mentioned indexes/columns do not
exist in dataframe, these will be added as
per the mentioned order with NaN
values.
df=df.reindex(columns=['product_name','Product_ID','product_category'])
print(df)

30
 By using fill_value, we can specify
which will be filled in the newly added
row/column.
df=df.reindex(columns=['product_name','Product_ID','product_category'],
index=[1,0],fill_value='Home')
print(df)

 Boolean indexing
 Like default indexing (0,1,2…) or labeled
indexing , there is one more way to index –
Boolean Indexing (Setting row index to True/
False etc.) .
 This helps in displaying the rows of Data Frame,
according to True or False as specified in the
command.
import pandas as pd
dict={'p_id':[101,102,103],'p_name':['Hard disk','Pen Drive','Camera']}
df=pd.DataFrame(dict)
df.index=[True,False,True]
print(df,"\n")
print(df.loc[True])

 DataFrame attributes
All information related to a DataFrame object is available through attributes.
<DataFrane object> . <attribute name>
Attribute Description
index Returns the index (row labels) of the DataFrame
columns Returns the column labels of the DataFrame
axes Returns a list representing both the axes of the Data
Frame (axis=0 i.e. index and axis=1 i.e. columns)
values Returns a Numpy representation of the DataFrame
dtypes Returns the dtypes of data in the DataFrame
shape Returns tuple of the shape of the DataFrame
ndim Returns number of dimensions of the dataframe
size Returns the number of elements in the dataframe
empty Returns True if the DataFrame object is empty, otherwise
False
T Transpose index and columns of DataFrame

Case study questions:


1. Consider the following Data Frame df and answer questions
A B C
DEPT CS PROD MEDICAL
EMPNO 101 102 103
ENAME ABC PQR LMN
SALARY 200000 100000 20000
31
i. Write code to delete column B
ii. Write the output of the below code
print(df.tail(2))
iii. Write code to delete row salary
iv. Change the value of column A to 100
v.Change the value of DEPT of B to MECH
vi. Display DEPT and SALARY of column A and B
vii. Write code to rename column ‘A’ to ‘D’ which will not effect original
dataframe
viii. Write code to add a column E with values [CS, 104,XYZ, 300000]
ix. Write code to add a row COMM with values [3000,4000,5000]
x. Write code to rename DEPT to DEPARTMENT which will effect the original
dataframe
xi. Write code to display DEPT in A
i. print(df.A[‘DEPT’])
ii. print(df[‘A’,’DEPT’])
iii. print(df.iloc[1:2,1:2])
iv. print(df.iat[3,2])

xii. Write the output of the statement print(len(df))


i. 3
ii. 4
iii. (4,3)
iv. (3,4)

Answers :=
i. del df['A']
ii. A B C
ENAME ABC PQR LMN
SALARY 200000 100000 20000
iii. df=df.drop(['SALARY'],axis=0)
iv. df['A']=100
v. df.B['DEPT']='MECH'
vi. print(df.loc[['DEPT','SALARY'],["A","B"]])
vii. df.rename(columns={"A":"D"},inplace=False)
viii. df['E']=["CS",104,"XYZ",300000]
ix. df.loc['COMM']=[3000,4000,5000]
x. df.rename(index={"DEPT":"DEPARTMENT"},inplace=True)
xi. print(df.A[‘DEPT’])
xii. 4
2. Consider the following Data Frame df and answer questions
ACC BST ECO IP
S1 90 91 92 93
S2 94 95 96 97
S3 98 99 100 100
S4 91 92 93 94
32
i. Create a new column total TOT by adding marks
ii. Find the highest marks scored by student s1
iii. Find the lowest marks scored by student s1
iv. Find the highest marks in ACC
v. Find the lowest marks in IP
Answers:=
i. df['TOT']=df['ACC']+df['BST']+df['ECO']+df['IP']
ii. print(max(df.loc['S1',:]))
iii. print(min(df.loc['S1',:]))
iv. print(max(df['ACC']))
v. print(min(df['IP']))

3. Consider the following Data Frame df and answer questions

delhi mumbai kolkatta chennai


hospitals 200 300 100 50
population 10 20 30 40 i. Display details of city delhi
schools 250 350 400 200 and chennai
ii. Display hospitals in delhi
iii. Display shape of dataframe
iv. Change the population in kolkatta as 50
v. Rename the column population as “pop”
Answers:=
i. print(df[['delhi','chennai']])
ii. print(df.delhi['hospitals'])
iii. print(df.shape)
iv. df.kolkatta['population']=50
v. df.rename(index={"population":"pop"},inplace=True)

4. Consider the following Data Frame df and answer questions

i. Display the name of city whose population >=20


range of 12 to 20
ii. Write command to set all vales of df as 0
iii. Display the df with rows in the reverse order
iv. Display the df with only columns in the reverse order
v. Display the df with rows & columns in the reverse order
Answers:-
i. print(df[df.population>=20])
33
ii. df[:]=0
iii. print(df.iloc[::-1)
iv. print(df.iloc[:,::-1])
v. print(df.iloc[::-1,::-1])
5. Consider the following Data Frame df and answer questions

Write the ouput of the following


i. print(len(df))
ii. print(df.count())
iii. print(df.count(1))
iv. print(min(df.loc['SALARY']))
v. print(max(df.loc['ENAME']))
Answers
i. 4
ii. A 4
B 4
C 4
dtype: int64
iii. DEPT 3
EMPNO 3
ENAME 3
SALARY 3
dtype: int64
iv. 20000
v. PQR
QUESTIONS ON DATAFRAME
1. What are the purpose of following statements-
1.df.columns
2. df.iloc[ : , :-5]
3. df[2:8]
4. df[ :]
5. df.iloc[ : -4 , : ]

Ans:
1. It displays the names of columns of the Dataframe.
2. It will display all columns except the last 5 columns.
3. It displays all columns with row index 2 to 7.
4. It will display entire dataframe with all rows and columns.
5. It will display all rows except the last 4 four rows

34
2. What will be the output of df.iloc[3:7,3:6]?
Ans:
It will display the rows with index 3 to 6 and columns with index 3 to 5 in a dataframe ‘df’.
3. Write a python program to create a data frame with headings (CS and IP) from the list
given below-
[[79,92][86,96],[85,91],[80,99]]
Ans:
l=[[10,20],[20,30],[30,40]]
df=pd.DataFrame(l,columns=['CS','IP'])
print(df)
4. Write python statement to delete the 3rd and 5th rows from dataframe df.
df1=df.drop(index=[2,4],axis=0)
or
df1=df.drop([2,4])

Sl
MCQ QUESTIONS
No
To display the 3rd, 4th and 5th columns from the 6th to 9th rows of a dataframe
you can write

(a) DF.loc[6:9, 3:5]


1 (b) DF.loc[6:10, 3:6]
(c) DF.iloc[6:10, 3:6]
(d) DF.iloc[6:9, 3:5]

ANS: c) DF.iloc[6:10, 3:6]


We can add a new row to a DataFrame using the _____________ method
(i) rloc[ ]
(ii) loc[ ]
2
(iii)iloc[ ]
(iv)None of the above
ANS: (ii) loc[ ]
The head() function of dataframe will display how may rows from top if no
parameter is passed.
(i) 1
(ii) 3
3
(iii) 5
(iv) None of these

ANS : (iii) 5
To change the 5th column's value at 3rd row as 35 in dataframe DF, you can
write
4
(a) DF[4, 6] = 35
(b) DF.iat[4, 6] = 35
(c) DF[3, 5] = 35

35
(d) DF.iat[3, 5] = 35

ANS:- d) DF.iat[3, 5] = 35
Which function is used to find values from a DataFrame D using the index
number?
a) D.loc
b) D.iloc
5
c) D.index
d) None of these

ANS: b) D.iloc
In a DataFrame, Axis= 0 represents the elements

a.rows
b.columns
6
c.both
d.None of these.

ANS: a.rows
In DataFrame, by default new column added as the _____________ column
(i) First (Left Side)
(ii) Second
7 (iii)Last (Right Side)
(iv) Any where in dataframe

ANS: (iii)Last (Right Side)


Which of the following is correct Features of DataFrame?
a. Potentially columns are of different types
b. Can Perform Arithmetic operations on rows and columns
c. Labeled axes (rows and columns)
8
d. All of the above

ANS: d. All of the above

Write the code to append df2 with df1

a.Df2=Df2.append(Df1)
b. Df2=Df2+Df1
9
c. Df2=Df2.appendwith.Df1
d. Df2=Df1.append(Df1)

ANS: a.Df2=Df2.append(Df1)
When we create DataFrame from List of Dictionaries, then number of columns in
DataFrame isequal to the _______
10 a. maximum number of keys in first dictionary of the list
b. maximum number of different keys in all dictionaries of the list
c. maximum number of dictionaries in the list

36
d. None of the above

ANS: b. maximum number of different keys in all dictionaries of the list


When we create DataFrame from List of Dictionaries, then dictionary keys will
become ______
(i) Column labels
(ii) Row labels
11
(iii) Both of the above
(iv) None of the above

ANS: (i) Column labels


Which method is used to access vertical subset of a dataframe?
(i) iterrows()
(ii) iteritems()
12 (iii) itercolumns()
(iv) itercols()

ANS: (ii) iteritems()


Write statement to transpose dataframe DF.
(i) DF.t
(ii) DF.transpose
13 (iii)DF.T
(iv)DF.T( )

ANS: (iii)DF.T
In DataFrame, by default new column added as the _____________ column
a. First (Left Side)
b. Second
14 c. Last (Right Side)
d. Any where in dataframe

ANS: Last (Right Side)


We can add a new row to a DataFrame using the _____________ method
(i) rloc[ ]
(ii) loc[ ]
15 (iii) iloc[ ]
(iv) None of the above

ANS: (ii) loc[ ]


Which of the following function is used to load the data from the CSV file to
DataFrame?

(i) read.csv( )
16
(ii) readcsv( )
(iii) read_csv( )
(iv) Read_csv( )

37
ANS: (iii) read_csv( )
Which of the following function is not a Boolean reduction function
(i) Empty
(ii) Any()
17 (iii) All()
(iv) Fillna()

ANS: (iv) Fillna()


Which among the following options can be used to create a DataFrame in
Pandas ?
(a) A scalar value
(b) An ndarray
18
(c) A python dict
(d) All of these

ANS:- (d) All of these


Which attribute of a dataframe is used to convert row into columns and columns
into rows in a dataframe?
a) T
b) ndim
19
c) empty
d) shape

ANS: a) T
When we create DataFrame from List of Dictionaries, then number of columns in
DataFrame is equal to the _______
(i) maximum number of keys in first dictionary of the list
(ii) maximum number of different keys in all dictionaries of the list
20
(iii) maximum number of dictionaries in the list
(iv) None of the above

ANS: (ii) maximum number of different keys in all dictionaries of the list
Which of the following is/are characteristics of DataFrame?
a) Columns are of different types
b) Can Perform Arithmetic operations
21 c) Axes are labeled (rows and columns)
d) All of the above

ANS: d) All of the above


Write short code to show the information having city=”Delhi” from dataframe
SHOP.

(a) print(SHOP[City==’Delhi’])
22
(b) print(SHOP[SHOP.City==’Delhi’])
(c) print(SHOP[SHOP.’City’==’Delhi’])
(d) print(SHOP[SHOP[City]==’Delhi’])

38
ANS: (b) print(SHOP[SHOP.City==’Delhi’])
Which of the following commands is used to install pandas?
(i)pip install python –pandas
(ii)pip install pandas
23 (iii)python install python
(iv)python install pandas

ANS: (ii) pip install pandas


Which attribute of a dataframe is used to get number of axis?
a.T
b.Ndim
c.Empty
24
d.Shape

ANS: b.Ndim

Display first row of dataframe ‘DF’


(i) print(DF.head(1))
(ii) print(DF[0 : 1])
25 (iii)print(DF.iloc[0 : 1])
(iv)All of the above

ANS: (iv)All of the above


To delete a column from a DataFrame, you may use statement.
(a) remove
(b) del
26 (c) drop
(d) cancel statement.

ANS:- (b) del


In given code dataframe ‘Df1’ has ________ rows and _______ columns
import pandas as pd
dict= [{‘a’:10, ‘b’:20}, {‘a’:5, ‘b’:10, ‘c’:20},{‘a’:7, ‘d’:10, ‘e’:20}]
Df1 = pd.DataFrame(dict)
(i) 3, 3
27 (ii) 3, 4
(iii)3, 5
(iv)None of the above

ANS: (iii)3, 5

To delete a row from a DataFrame, you may use


(a) remove
(b) del
28
(c) drop
(d) cancel

39
ANS:- (c) drop
In the following statement, if column ‘mark’ already exists in the DataFrame ‘Df1’
then the assignment statement will __________ Df1['mark'] = [95,98,100] #There
are only three rows in DataFrame Df1
(i) Return error
29 (ii) Replace the already existing values.
(iii)Add new column
(iv)None of the above

ANS: (ii) Replace the already existing values.


To skip first 5 rows of CSV file, which argument will you give in
read_csv( ) ?

(a) skip_rows = 5
30 (b) skiprows = 5
(c) skip - 5
(d) noread - 5

ANS:- (a) skip_rows = 5


. Which of the following statement is false:
i. DataFrame is size mutable
ii. DataFrame is value mutable
iii. DataFrame is immutable
31
iv. DataFrame is capable of holding multiple types of data

ANS:- iii. DataFrame is immutable

Which of the following statements is false?


(i) Dataframe is size mutable
(ii) Dataframe is value mutable
32 (iii) Dataframe is immutable
(iv) Dataframe is capable of holding multiple type of data

ANS: (iii) Dataframe is immutable


To delete a row, the parameter axis of function drop( ) is assigned the value
______________
(i) 0
(ii) 1
33
(iii) 2
(iv) 3

ANS: (i) 0
Which of the following function is used to load the data from the CSV file to
DataFrame?
34 (i) read.csv( )
(ii) readcsv( )
(iii)read_csv( )

40
(iv)Read_csv( )

ANS: (iii)read_csv( )
Write code to delete rows those getting 5000 salary.
(a) df=df.drop[salary==5000]
(b) df=df[df.salary!=5000]
35 (c) df.drop[df.salary==5000,axis=0]
(d) df=df.drop[salary!=5000]

ANS: (b) df=df[df.salary!=5000]


DF1.loc[ ] method is used to ______ # DF1 is a DataFrame
(i) Add new row in a DataFrame ‘DF1’
(ii) To change the data values of a row to a particular value
36 (iii)Both of the above
(iv)None of the above

ANS: (iii)Both of the above


To iterate over horizontal subsets of dataframe,
(a) iterate( )
(b) iterrows( ) function may be used.
(c) itercols( )
(d) iteritems( )
37
ANS:- (b) iterrows( ) function may be used.

Write code to delete the row whose index value is A1 from dataframe df.

(a) df=df.drop(‘A1’)
(b) df=df.drop(index=‘A1’)
38
(c) df=df.drop(‘A1,axis=index’)
(d) df=df.del(‘A1’)

ANS: (a) df=df.drop(‘A1’)


A two-dimension labeled array that is an ordered collection of columns to store
heterogeneous data type is
i. Series
ii. ii. Numpy array
39
iii. iii. Dataframe
iv. iv. Panel

ANS:- iii. Dataframe


To skip 1st, 3rd and 5th rows of CSV file, which argument will you give in
read_csv( ) ?
40
(a) skiprows = 11315
(b) skiprows - (1, 3, 5]
41
(c) skiprows = [1, 5, 1]
(d) Any of these

ANS:- (b) skiprows - (1, 3, 5]


In Pandas _______________ is used to store data in multiple columns.
(i)Series
(ii) DataFrame
41 (iii) Both of the above
(iv) None of the above

ANS: (ii) DataFrame


What is dataframe?
a. 2 D array with heterogeneous data
b. 1 D array with homogeneous data
c. 2 D array with homogeneous data
42
d. 1 D array with heterogeneous data

ANS: a. 2 D array with heterogeneous data

In a DataFrame, Axis= 1 represents the_____________ elements


(a) Row
(b) Column
(c) True
43
(d) False

ANS: (b) Column

Which of the following is not an attribute of a DataFrame Object ?


a. index
b. Index
44 c. size
d. value

ANS: b. Index
To get top 5 rows of a dataframe, you may use
(a) head( )
(b) head(5)
45 (c) top( )
(d) top(5)

ANS:- (a) head( ) , b) head(5)


27. To iterate over horizontal subsets of dataframe,
(a) iterate( )
(b) iterrows( ) function may be used.
46
(c) itercols( )
(d) iteritems( )

42
ANS:- (b) iterrows( ) function may be used.
Write code to delete the row whose index value is A1 from dataframe df.
(a) df=df.drop(‘A1’)
(b) df=df.drop(index=‘A1’)
(c) df=df.drop(‘A1,axis=index’)
47
(d) df=df.del(‘A1’)

ANS: (a) df=df.drop(‘A1’)

A two-dimension labelled array that is an ordered collection of columns to store


heterogeneous datatype is
v. Series
vi. ii. Numpy array
48
vii. iii. Dataframe
viii. iv. Panel

ANS:- iii. Dataframe


To skip 1st, 3rd and 5th rows of CSV file, which argument will you give in
read_csv( ) ?
(a) skiprows = 11315
(b) skiprows - (1, 3, 5]
49
(c) skiprows = [1, 5, 1]
(d) Any of these

ANS:- (b) skiprows - (1, 3, 5]


In a DataFrame, Axis= 1 represents the_____________ elements
(a) Row
(b) Column
50 (c) True
(d) False

ANS: (b) Column


NaN stands for:
a. Not a Number
b. None and None
51
c. Null and Null
d. None a Number
ANS: a. Not a Number
To get top 5 rows of a dataframe, you may use
(a) head( )
(b) head(5)
52 (c) top( )
(d) top(5)

ANS:- (a) head( ) , b) head(5)


The correct statement to read from a CSV file in a dataframeis :
53
(a) .read_csv()

43
(b) . read_csv( )()
(c) = pandas.read()
(d) = pandas.read_csv()

ANS:- (d) = pandas.read_csv()


To delete a column from a dataframe, you may use ______ statement.
i. remove()
ii. ii. del()
54 iii. iii. drop()
iv. iv. cancel()

ANS:- iii. drop()


The following code create a dataframe named ‘Df1’ with _______________
columns.
import pandas as pd
Df1 = pd.DataFrame([10,20,30] )
(i) 1
55
(ii) 2
(iii) 3
(iv) 4

ANS: (i) 1
To delete a row from dataframe, you may use _______ statement.
i. remove()
ii. ii. del()
56 iii. iii. drop()
iv. iv. cancel()

ANS:- ii. del()


In a Data-Frame, Axis= 0 represents the elements along the______
a. Row
b. Column
57 c. Row and Column Both
d. None of the above

ANS: a. Row
___________ method in Pandas can be used to change the index of rows and
columns of a Series or Dataframe
(a) rename()
(b) reindex()
58
(c) reframe()
(d) none of these

ANS: (b) reindex()


Write the single line command to delete the column “marks” from dataframe df
59 using drop function.
(a) df=df.drop(col=‘marks’)

44
(b) df=df.drop(‘marks’,axis=col)
(c) df=df.drop(‘marks’,axis=0)
(d) df=df.drop(‘marks’,axis=1)

ANS: (d) df=df.drop(‘marks’,axis=1)


Which of the following is used to give user defined column index in DataFrame?
(i) index
(ii) column
60 (iii) columns
(iv) colindex

ANS: (iii) columns


The following statement will _________
df = df.drop(['Name', 'Class', 'Rollno'], axis = 1) #df is a DataFrame object

a. delete three columns having labels ‘Name’, ‘Class’ and ‘Rollno’


61 b. delete three rows having labels ‘Name’, ‘Class’ and ‘Rollno’
c. delete any three columns
d. return error

ANS:- a. delete three columns having labels ‘Name’, ‘Class’ and ‘Rollno’
Difference between loc() and iloc().:
a. Both are Label indexed based functions.
b. Both are Integer position-based functions.
c. loc() is label based function and iloc() integer position based function.
62
d. loc() is integer position based function and iloc() index position based function.

ANS: c. loc() is label based function and iloc() integer position based
function.
Which command will be used to delete 3 and 5 rows of the data frame. Assuming
the data frame name as DF.
a. DF.drop([2,4],axis=0)
b. DF.drop([2,4],axis=1)
63
c. DF.drop([3,5],axis=1)
d. DF.drop([3,5])

ANS: a DF.drop([2,4],axis=0)
Assuming the given structure, which command will give us the given output:
Output Required: (3,4)

EmpCode Name Desig

64 0 1405 VINAY Clerk


1 1985 MANISH Works Manager
2 1636 SMINA Sales Manager
3 1689 RINU Cleark
a. print(df.shape())
b. print(df.shape)
45
c. print(df.size)
d. print(df.size()).

ANS: b. print(df.shape)
Write the output of the given command: df1.loc[:0,'Name'] Consider the given
dataframe.
EmpCode Name Desig
0 1405 VINAY Clerk
1 1985 MANISH Works Manager
2 1636 SMINA Sales Manager
65
3 1689 RINU Clerk

a. 0 1405 VINAY Clerk


b. VINAY
c. Works Manager
d. Clerk
ANS : VINAY

46
Index
Importing/Exporting Data between CSV files and Data Frames
Basics of CSV Files
 CSV Files : A CSV file is a delimited value file. All CSV files are simple text files, can contain only numbers
and letters and structure the data contained in them in tabular form.
 Files with the CSV extension are usually used to exchange data between different applications. Database
programs, analytical software, and other applications that store large amounts of information (for
example, contacts and customer data) usually support the CSV format.
 All CSV files have the same general format: each column is separated by a comma and each new row
indicates a new row. Some programs that export data to a CSV file may use a different character to
separate values, such as a tab, semicolon, or space.
 For example consider the data regarding medals won by India at Commonwealth Games 2022 stored in
a csv file medaltally.csv created using a spreadsheet software like Microsoft Excel or Libreoffice Calc.

When opened with spreadsheet like Excel. When opened with text editor like Notepad.

Importing CSV Files to Dataframes


pandas.read_csv is used to read a comma-separated values (csv) file into DataFrame.
pandas.read_csv(filepath, sep=',', header='infer', names=NoDefault.no_default,
index_col=None, skiprows=None, skipfooter=0, nrows=None)
Parameters

filepath :str, path object or file-like object


Any valid string path is acceptable. The string could be a URL.
sep :str, default ‘,’
Delimiter to use.
header :int, list of int, None, default ‘infer’
Row number(s) to use as the column names, and the start of the data. Default behavior is to
infer the column names: if no names are passed the behavior is identical to header=0 and
47
column names are inferred from the first line of the file, if column names are passed explicitly
then the behavior is identical to header=None.

names : array-like, optional


List of column names to use. If the file contains a header row, then you should explicitly pass
header=0 to override the column names. Duplicates in this list are not allowed.
index_col : int, str, sequence of int / str, or False, optional, default None
Column(s) to use as the row labels of the DataFrame, either given as string name or column
index.
skiprows : list-like, int
Line numbers to skip (0-indexed) or number of lines to skip (int) at the start of the file.
nrows: int, optional
Number of rows of file to read.

Example 1 : Consider the following file medaltally.csv. Here header argument is 0 and index_col is
None. Hence index becomes 0,1,2,3,...,12 and first row as column labels.

Example 2 : Consider the following file medaltally.csv. Here header argument is 0 and index_col is
0. Hence, first column values are taken as index labels and first row as column labels.

Note: 'Sport' is not an index. It is medaltally2.index.name

48
Example 3 : Consider the following file medaltally2.csv with the data regarding some events missing.
Those missing data are read as NaN.

Note: 'Sport' is not an index. It is medaltally2.index.name


Example 4 : Consider the following file medaltally.csv read with only first 5 rows to be read.

Example 5 : Consider the following file medaltally.csv to be read with rows 1,3,4,5 to be skipped.

Here rows numbers are taken as weightlifting 1, Judo 2, and


so on.

Example 6 Consider the following file medaltally.csv to be read with user specified column names 'Gold',
'Silver', and 'Bronze'.

49
Note : Here rows numbers are taken as weightlifting 1, Judo
2, and so on.

Example 7 : Consider the following file processed5_medaltally.csv to be read with separator as '#'.

Exporting Dataframes to CSV Files


DataFrame.to_csv(path = None, sep=',', na_rep='', header=True, index=True)

DataFrame.to_csv is used to write a pandas object to a comma-separated values (csv)


file.Parameters

path : str, default None


String
sep :str, default ‘,’
String of length 1. Field delimiter for the output file.
na_rep : str, default ‘’
Missing data representation.
header : bool or list of str, default True
Write out the column names. If a list of strings is given it is assumed to be aliases for the
column names.
index :bool, default True
Write row names (index).

50
Example 1 : Consider the dataframe medaltally. Here header and index arguments are True;
Hence the index and column labels are written to the csv file processed_medaltally.csv.

Example 2 : Consider the dataframe medaltally. Here header is False and index argument is
True; Hence the columns labels are not present in file processed2_medaltally.csv.

Example 3 : Consider the dataframe medaltally. Here header is True and index argument is
False; Hence the index labels are not present in the file processed3_medaltally.csv but column labels
are present.

51
Example 4 : Consider the dataframe medaltally. Here header is False and index argument is
False; Hence the index labels as well as the header are not present in written file
processed4_medaltally.csv. Only data is present in the file processed4_medaltally.csv.

Example 5 : Consider the dataframe medaltally. The default delimiter ',' in a csv file can be
changed by setting the sep argument in to_csv. Here delimiter is changed to '#'.

File opened in text editor

Exercises
1. Given the following csv file which of the command will correctly read the details into a dataframe from
csv file sectors_economy.csv.

a. pandas.read_csv('sectors_economy.csv', header = 0, index_col = 0 )


b. pandas.read_csv('sectors_economy.csv', header = 0, index_col = 1 )
52
c. pandas.read_csv('sectors_economy.csv', header = 1, index_col = 0 )
d. pandas.read_csv('sectors_economy.csv', header = 1, index_col = 1 )
Consider the following dataframe literacy for questions 2 and 3.

2. Which of the commands will correctly write literacy to literacy.csv with index and column labels.

a. literacy.to_csv("literacy.csv", index = False, header = False )


b. literacy.to_csv("literacy.csv", index = True, header = False)
c. literacy.to_csv("literacy.csv", index = False, header = True)
d. literacy.to_csv("literacy.csv", index = True, header = True)
3. Which of the commands will correctly write literacy to literacy.csv without index and column labels
i.e the data alone.
a. literacy.to_csv("literacy.csv", index = False, header = False )
b. literacy.to_csv("literacy.csv", index = True, header = False)
c. literacy.to_csv("literacy.csv", index = False, header = True)
d. literacy.to_csv("literacy.csv", index = True, header = True)
4. Which of the arguments needs to be set so that the index labels will be written into literacy.csv.

a. index b. header c. index_col d. header_row

5. The argument to be set in read_csv for reading user specified number of rows from a csv file is:

a. rows b. row c. nrows d. nrow

Answers

1. a

2. d

3. a

4. a

5. c

53
Index
Data Visualization
What is Data Visualization ?
Data visualization is the technique to present the data in a pictorial or graphical format. It
enables stakeholders and decision makers to analyze data visually. The data in a graphical
format allows them to identify new trends and patterns easily.

The main benefits of data visualization are as follows:

 It simplifies the complex quantitative information


 It helps analyze and explore big data easily
 It identifies the areas that need attention or improvement
 It identifies the relationship between data points and variables
 It explores new patterns and reveals hidden patterns in the data

Purpose of Data visualization:


 Better analysis
 Quick action
 Identifying patterns
 Finding errors
 Understanding the story
 Exploring business insights
 Grasping the Latest Trends

matplotlib Library and pyplot Interface


• The matplotlib is a python library that provides many interfaces functionally for 2D graphics
• In short we can call mattplotlib as a high quality plotting library of Python.
• The matplotlib library offers many different named collections of methods, pyplot is one such
interface.
• pyplot is a collection of methods within matplotlib which allows user to construct
2D plots easily and interactively.
Installing matplotlib

It is done using pip command in Command Prompt

pip install matplotlib

Importing PyPlot
54
To import Pyplot following syntax is
import matplotlib.pyplot
or
import matplotlib.pyplot as plt

After importing matplotlib in the form of plt we can use plt for accessing any function of
matplotlib

Steps to plot in matplotlib:


• Create a .py file & import matplotlib library to it using import statement
import matplotlib.pyplot as plt
• Set data points in plot( ) method of plt object
• Customize plot by setting different parameters

• Call the show() method to display the plot

• Save the plot/graph if required

Types of plot using matplotlib


• LINE PLOT
• BAR GRAPH
• 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 data points called markers 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.

Line chart: displaying data in form of lines.

• We can create line graph with x coordinate only or with x and y coordinates.
• Function to draw line chart – plot()
• Default colour of line- blue
55
 The default width for each bar is .0.8 units, which can be changed.

• Syntax: plt.plot(x,y)
Line Plot customization
• Custom line color
plt.plot(x,y,'red')
Change the value in color argument like ‘b’ for blue,’r’,’c’,…..

• Custom line style and line width


plt.plot(x,y, linestyle='solid' , linewidth=4).
set linestyle to solid/dashed/dotted/dashdot
set linewidth as required
• Title
plt.title('DAY – TEMP Graph ') – Change it as per requirement

• Label-
plt.xlabel(‘TIme') – to set the x axis label
plt.ylabel(‘Temp') – to set the y axis label
 Changing Marker Type, Size and Color
plt.plot(x,y,'blue',marker='*',markersize=10,markeredgecolor='magenta')

Order of methods used in plot() function:


Plt.plot(x,y,color,linewidth,linestyle,marker, markersize,markeredgecolor)

Function used to show the graph – show()


plt.show( )
PROGRAM
import matplotlib.pyplot as plt
X=[1,2,3,4,5]
Y=[2,4,6,8,10]
plt.title('Simple Line Graph')
plt.xlabel('X Axis')
plt.ylabel('Y Axis')
plt.plot(X,Y,'r')
plt.show()

56
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 of bar graph is to show the relationship between the two axes. Bar graph can
also show big changes in data over time.
 Syntax : plt.bar(x,y)
Bar graph customization
• Custom bar color
plt.bar(x,y, color="color code/color name")
To se different colors for different bars
plt.bar(x,y, color="color code/color name sequence")
• Custom bar width
plt.bar(x,y, width=float value)
To set different widths for different bars
plt.bar(x,y, width=float value sequence)
• Title
plt.title(' Bar Graph ') – Change it as per requirement
• Label-
plt.xlabel(‘Overs') – to set the x axis label
plt.ylabel(‘Runs') – to set the y axis label
PROGRAM :
import matplotlib.pyplot as plt
overs=['1-10','11-20','21-30','31-40','41-50']
runs=[65,55,70,60,90]
plt.xlabel('Over Range')
plt.ylabel('Runs Scored')
plt.title('India Scoring Rate')
plt.bar(overs,runs)
plt.show( )

57
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.
Difference between a histogram and a bar chart / graph –
A bar chart majorly represents categorical data (data that has some labels
associated with it), they are usually represented using rectangular bars with lengths
proportional to the values that they represent. While histograms on the other hand, is used to
describe distributions.

Creating a Histogram :

 It is a type of bar plot where X-axis represents the bin ranges while Y-axis gives information
about frequency.

 To create a histogram the first step is to create bin of the ranges, then distribute the whole
range of the values into a series of intervals, and count the values which fall into each of
the intervals.
58
 Bins are clearly identified as consecutive, non-overlapping intervals of variables.

 The hist() function is used to create histogram

 Syntax:
plt.hist(x,other parameters)

Optional Parameters
x array or sequence of array

bins optional parameter contains integer or


sequence or strings

histtype optional parameter used to create type


of histogram [bar, barstacked, step,
stepfilled], default is “bar”

align optional parameter controls the plotting


of histogram [left, right, mid]
orientation Optional. Possible values are
‘horizontal’ or ‘vertical’

color optional parameter used to set color or


sequence of color specs

PROGRAM :

import matplotlib.pyplot as plt


data=[7,7,7,8,8,8,8,8,9,10,10,10,11,11,12,12,12,13]
plt.xlabel('Data')
plt.ylabel('Frequency')
plt.title('Histogram')
plt.hist(data,bins=7,color='green')
plt.show()

59
• Title
plt.title('Histogram ') – Change it as per requirement
• Label-
plt.xlabel(‘Data') – to set the x axis label
plt.ylabel(‘Frequency') – to set the y axis label

• Legend - A legend is an area describing the elements of the graph. In the matplotlib library
there is a function named legend() which is used to place a legend on the axes .
When we plot multiple ranges in a single plot ,it becomes necessary that legends are specified.It
is a color or mark linked to a specific data range plotted .

To plot a legend you need to do two things.

i)In the plotting function like bar() or plot() , give a specific label to the data range using label

ii)Add legend to the plot using legend ( ) as per the sytax given below .

Syntax : - plt.legend((loc=position number or string)

position number can be u1,2,3,4 specifying the position strings upper right/'upper left/'lower
left/lower right respectively .

60
Default position is upper right or 1

Saving the Plot

To save any plot savefig() method is used. Plots can be saved in various formats like
pdf,png,eps etc .
plt.savefig('line_plot.pdf') // save plot in the current directory
plt.savefig('d:\\plot\\line_plot.pdf') // save plot in the given path

WORKSHEET 1
1.What is data visualization?
a) It is the numerical representation of information and data
b) It is the graphical representation of information and data
c) It is the character representation of information and data
d) None of the above

2.Which is a python package used for 2D graphics?


a) matplotlib.pyplot
b) matplotlib.pip
c) matplotlib.numpy
d) mathplotlib.pyplot
3.The command used to give a heading to a graph is _________
(a) plt.show()
(b) plt.plot()
(c) plt.xlabel()
(d) plt.title()
4. Using Python Matplotlib _________ can be used to count how many values fall into each
interval.
(a) line plot
(b) bar graph
(c) histogram
61
(d) None of these
5.Fill the missing statement
import matplotlib.pyplot as plt
marks=[30,10,55,70,50,25,75,49,28,81]
plt._____(marks, bins=’auto’, color=’green’)
plt.show()
(a) plot
(b) bar
(c)hist
(d)draw
6.Which module of matplotlib library is required for plotting of graph ?
(a) Plot
(b) Matplot
(c) pyplot
(d) graphics
7.Observe the output figure. Identify the code for obtaining this output.

a) import matplotlib.pyplot as plt


plt.plot([1,2],[4,5])
plt.show()
b) import matplotlib.pyplot as plt
plt.plot([2,3],[5,1])
plt.show()
c) import matplotlib.pyplot as plt
plt.plot([1,2,3],[4,5,1])
plt.show()
d) import matplotlib.pyplot as plt
62
plt.plot([1,3],[4,1])
plt.show()

8.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.
Hint 2: The line in this type of chart is often drawn chronologically.
a) Line chart
b) Bar chart
c) Pie chart
d) Scatter plot

9.Which of the following is/are correct statement for plot method?


a) plt.plot(x,y,color,others)
b) pl.plot(x,y)
c) pl.plot(x,y,color)
d) All the above

10. Consider the following graph. Write the code to plot it

ANSWERS
1. b) It is the graphical representation of information and data
2. a) matplotlib.pyplot
3. d) plt.title()
4. c) histogram
5. c)hist
6. c) pyplot
7. c) import matplotlib.pyplot as plt
plt.plot([1,2,3],[4,5,1])
plt.show()

63
8. a) Line chart
9. d) All the above
10. import matplotlib.pyplot as plt
a = [1,2,3,4,5]
b = [10,31,26,24,20]
plt.plot(a,b)
plt.show()
WORKSHEET 2

1.To give a title to x-axis, which of the following


method is used?
a) plt.xtitle(“title”)
b) plt.xlabel(“title”)
c) plt.xheader(“title”)
d) plt.xlabel.show(“title”)

2.To change the width of bars in bar chart, which of the following argument
with a float value is used?
a) thick
b) thickness
c) width
d) barwidth

3.What is the purpose of legend?


a) A legend is an area describing the elements of the graph.
b) A legend is top area with information about graph
c) A legend is additional information of x and y labels
d) A legend is a mini box with bars data

4.Which function can be used to export generated graph in matplotlib to


png
1. a) savefigure ( )
2. b) savefig( )
3. c) save( )
4. d) export ( )

5.which one of these is not a valid line style in matplotlib


a) ‘-‘
b) ‘--‘
c) ‘-.’
d) ‘<’
64
6.How can we make bar chart horizontal?
a) plt.bar()
b) plt.hbar()
c) plt.barh()
d) plt.rightbar()

7. A histogram is used:
a) for continuous data
b) for grouped data
c) for time series data
d) to compare two sets of data
8.Which function is used to show legend ?
a) display ( )
b) show( )
c) legend( )
d) legends( )

9.The datapoints plotted on a graph are called _____________


a) Markers
b) Values
c) Ticks
d) Pointers

10.Write code to draw the following bar graph representing the classes and number of students
in each class.

65
Answers:

1. b) plt.xlabel(“title”)
2. c) width
3. a) A legend is an area describing the elements of the graph.
4. b) savefig( )
5. d) ‘<’
6. c) plt.barh()
7. a) for continuous data
8. c) legend( )
9. a)Markers
10.
import matplotlib.pyplot as plt
classes = ['VII','VIII','IX','X']
students = [40,45,35,44]
plt.barh(classes, students)
plt.show()
WORKSHEET 3
1.To specify the style of line as dashed , which argument of plot() needs to be set ?
a) line
b) width
c) Style
d) linestyle

2. Which of the following is not a valid plotting function in pyplot?


a) bar()
b) hist()
c) histh()
d) barh()

3.Observe the following figure. Identify the coding for obtaining this as output.

a) import matplotlib.pyplot as plt


66
eng_marks=[10,55,30,80,50]
st_name=["amit","dinesh","abhishek","piyush","rita"]
plt.plot(st_name,eng_marks)
plt.show()

b) import matplotlib.pyplot as plt


eng_marks=[10,55,30,80,50]
st_name=["amit","dinesh","abhishek","piyush","rita"]
plt.plot(st_name,eng_marks)

c) import matplotlib.pyplot as plt


eng_marks=[10,55,30,80,50]
st_name=["amit","dinesh","abhishek","piyush","rita"]
plt.plot(eng_marks, st_name)
plt.show()

d) import matplotlib.pyplot as plt


eng_marks=[10,55,30,80,50]
st_name=["amit","dinesh","abhishek","piyush","rita"]
plt.plot(eng_marks, st_name)
plt.show()

4.Read the statements given below and identify the right option to draw a histogram.
Statement A: To make a Histogram with Matplotlib, we can use the plt.hist() function.
Statement B: The bin parameter is compulsory to create histogram.
a) Statement A is correct
b) Statement B is correct
c) Statement A is correct, but Statement B is incorrect
d) d. Statement A is incorrect, but Statement B is correct

5. Which graph should be used where each column represents a range of values, and the
height of a column corresponds to how many values are in that range?
a) plot
b) line
c) bar
d) histogram
Go through the following case study and answer the questions 6 to 10.

67
Mr. Sharma is working in a game development industry and he was comparing the given
chart on the basis of the rating of the various games available on the play store. He is trying
to write a code to plot the graph. Help Mr. Sharma to fill in the blanks of the code and get
the desired output.

import__________________________ #Statement 1
Games=[“Subway Surfer”,”Temple Run”,”Candy Crush”,”Bottle hot”,”Runner Best”]
Rating=[4.2,4.8,5.0,3.8,4.1]
plt.______________(Games,Rating) #Statement 2
plt.xlabel(“Games”)
plt.______________(“Rating”) #Statement 3
plt._______________ #Statement 4
6) Choose the right code from the following for statement 1.
(a) matplotlib as plt
(b) pyplot as plt
(c) matplotlib.pyplot as plt
(d) matplotlib.plt as pyplot
7) Identify the name of the function that should be used in statement 2 to plot the above
graph.
(a) line()
68
(b) bar()
(c) hist()
d) barh()
8) Choose the correct option for the statement 3.
(a) title(“Rating”)
(b) ytitle(“Rating”)
(c) ylabel(“Rating”)
(d) yaxis(“Rating”)
9) Choose the right function/method from the following for the statement 4.
(a) display()
(b) print()
(c) bar()
(d) show()
10) In case Mr. Sharma wants to change the above plot to any other shape, which
statement, should he change.
(a) Statement 1
(b) Statement 2
(c) Statement 3
(d) Statement 4
11.Write a program to generate a histogram with the following values
X=[25,28,35,46,57,68,73]
Include the following parameters/arguments along with historam
1.It should be a horizontal histogram
2.Number of bins should be 20
ANSWERS
1. d) linestyle
2. c)histh( )
69
3. import matplotlib.pyplot as plt
eng_marks=[10,55,30,80,50]
st_name=["amit","dinesh","abhishek","piyush","rita"]
plt.plot(st_name,eng_marks)
plt.show()
4. c) Statement A is correct, but Statement B is incorrect
5. d). histogram
6. c) matplotlib.pyplot as plt
7. b) bar()
8. c) ylabel(“Rating”)
9. d) show()
10. b) Statement 2
11.
import matplotlib.pyplot as plt
X=[25,28,35,46,57,68,73]
plt.hist(X,orientation='horizontal',bins=20)
plt.show()

70
Index
UNIT 2
Database Query and SQL Math Functions
 POW( ) or POWER( )
POWER( A, B) or POW( A, B) returns the number A raised to the power of another
number B. Here the number A is the base and the number B is the exponent.
Needs two numbers as parameters.
SYNTAX: SELECT POW(A, B);
Examples:
1) mysql> select power(2,3);
+ +
| power(2,3) |
+ +
| 8 |
+ +
1 row in set (0.05 sec)
2) mysql>select pow(2,3);
+ +
| pow(2,3) |
+ +
| 8 |
+ +
1 row in set (0.00 sec)

3) mysql>select pow(2.0 , 3.0);


+ -+
| pow(2.0,3.0) |
+ -+
| 8 |
+ -+
1 row in set (0.00 sec)
 ROUND( )
This function is used to round the number to the specified number of decimal
places. Parameters required: the number to be rounded and the number of
decimal places required.
If the number of decimal places required is not mentioned, then the result will not have
decimal places
SYNTAX: SELECT ROUND(NUMBER, NUMBER OF DECIMAL PLACES)
Examples :
1) mysql>select round(2.25);
+ +
| round(2.25) |
+ +
| 2 |
+ +
1 row in set (0.01 sec)
71
2) mysql>select round(2.25, 1);
+ +
| round(2.25, 1) |
+ +
| 2.3 |
+ +
1 row in set (0.00 sec)
3) mysql>select round(2.25, 2);
+ +
| round(2.25, 2) |
+ +
| 2.25 |
+ +
1 row in set (0.00 sec)
4) mysql>select round (2.26, 0);
+ +
| round(2.26, 0) |
+ +
| 2 |
+ +
1 row in set (0.00 sec)
5) mysql>select round(135.43, 0);
+ +
| round(135.43, 0) |
+ +
| 135 |
+ +
6) mysql>select round(135.53, 0);
+ +
| round(135.53, 0) |
+ +
| 136 |
+ +
1 row in set (0.00 sec)
7) mysql>select round(135.55, 1);
+ +
| round(135.55, 1) |
+ +
| 135.6 |
+ +
1 row in set (0.00 sec)

8) mysql>select round(135.55, -1);


+ +
| round(135.55, -1) |
+ +
| 140 |
72
+ +
1 row in set (0.00 sec)
9) mysql>select round(134.45, -1);
+ +
| round(134.45, -1) |
+ +
| 130 |
+ +
1 row in set (0.00 sec)
10) mysql>select round(134.45, -2);
+ +
| round(134.45, -2) |
+ +
| 100 |
+ +
1 row in set (0.00 sec)
11) mysql>select round(154.45, -2);
+ +
| round(154.45, -2) |
+ +
| 200 |
+ +
1 row in set (0.00 sec)

12) mysql>select round(1454.45, -2);


+ +
| round(1454.45, -2) |
+ +
| 1500 |
+ +
1 row in set (0.00
sec)
13) mysql>select round(1444.45, -2);
+ +
| round(1444.45, -2) |
+ +
| 1400 |
+

+
1 row in set (0.00
sec)
14) mysql>select round(1444.45, -3);
+ +
| round(1444.45, -3) |
+ +
| 1000 |
+ + 1 row in set (0.00 sec)
73
15) mysql>select round(1544.45, -3);
+ +
| round(1544.45, -3) |
+ +
| 2000 |
+ +
1 row in set (0.00 sec)

 MOD( )
This function can be used to find modulus (remainder) when one number is divided
by another.
Examples:
mysql>select mod(5,3)
+ +
| mod(5,3) |
+ +
| 2 |
+ +
1 row in set (0.00 sec)

1) mysql> select mod(5,4);


+ +
| mod(5,4) |
+ +
| 1 |
+ +
1 row in set (0.00 sec)

2) mysql>select mod(4,2);
+ -+
| mod(4,2) |
+ +
| 0 |
+ +
1 row in set (0.00 sec)

Text/String/Character Functions:
 UCASE( ) / UPPER( )
Used to convert a character or text to uppercase.
Examples:
1) mysql>SELECT UCASE('hello');
+ +
| UCASE('hello') |
+ +
| HELLO |
+ +
1 row in set (0.00 sec)

74
2) mysql>SELECT Upper('hello');
+ +
| Upper('hello') |
+ +
| HELLO |
+ +
1 row in set (0.00 sec)

 LCASE( ) / LOWER( ) :
Used to convert a character or text to lowercase.
Examples:
1) mysql>select lcase('HELLO');
+ +
| lcase('HELLO') |
+ +
| hello |
+ +
1 row in set (0.00 sec)
2) mysql>select LOWER('HELLO');
+ +
| LOWER('HELLO') |
+ +
| hello |
+ +
1 row in set (0.00 sec)
 MID( ) : To extract a specified number of characters from the string.
First parameter is the text/string. Second parameter is the starting index
and the thirdparameter is the number of characters required.
(Note: index starts with 1 and not 0.)
Examples:
1) mysql>SELECT MID('ABCDEFGHIJKLMNOP', 1,4);
+ +
| MID('ABCDEFGHIJKLMNOP', 1,4) |
+ +
| ABCD |
1 row in set (0.00
sec)
2) mysql>SELECT MID('ABCDEFGHIJKLMNOP', 1);
+ +
| MID('ABCDEFGHIJKLMNOP', 1) |
+ +
| ABCDEFGHIJKLMNOP |
+ 1 row in set (0.00 sec)

75
3) mysql> SELECT MID('ABCDEFGHIJKLMNOP', -2,-1);
+ +
| MID('ABCDEFGHIJKLMNOP', -2,-1) |
+ +
| |
+ 1 row in set (0.00
sec)
4) mysql>SELECT MID('ABCDEFGHIJKLMNOP', 0,4);
+ +
| MID('ABCDEFGHIJKLMNOP', 0,4) |
+ +
| |
1 row in set (0.00
sec)
(Please note the output of example 3, 4 )
5) mysql>SELECT MID('ABCDEFGHIJKLMNOP', 3,4);
+ +
| MID('ABCDEFGHIJKLMNOP', 3,4) |
+ +
| CDEF |
+ 1 row in set (0.00 sec)
6) mysql>SELECT MID('ABCDEFGHIJKLMNOP', -4,2);
+ +
| MID('ABCDEFGHIJKLMNOP', -4,2) |
+ +
| MN |
+ + 1 row in set (0.00 sec)
 SUBSTRING( ) : Same as MID( ) function
To extract a specified number of characters from thestring.
Examples:
1) mysql>SELECT SUBSTRING('ABCDEFGHIJKLMNOP', 3,4);
+ +
| SUBSTRING('ABCDEFGHIJKLMNOP', 3,4) |
+ +
| CDEF |
+ 1 row in set (0.00 sec)

2) mysql>SELECT SUBSTRING('ABCDEFGHIJKLMNOP', 0,4);


+ +
| SUBSTRING('ABCDEFGHIJKLMNOP', 0,4) |
+ +
| |
+ 1 row in set (0.00 sec)

76
3) mysql>SELECT SUBSTRING('ABCDEFGHIJKLMNOP', 1,4);
+ +
| SUBSTRING('ABCDEFGHIJKLMNOP', 1,4) |
+ +
| ABCD |
+ 1 row in set (0.00 sec)
4) mysql>SELECT SUBSTRING('ABCDEFGHIJKLMNOP', 4,2);
+ +
| SUBSTRING('ABCDEFGHIJKLMNOP', 4,2) |
+ +
| DE |
+ 1 row in set (0.00 sec)
5) mysql>SELECT SUBSTRING('ABCDEFGHIJKLMNOP', -4,2);
+ +
| SUBSTRING('ABCDEFGHIJKLMNOP', -4,2) |
+ +
| MN |
+ 1 row in set (0.00 sec)
 SUBSTR( ) : Same as that of MID( ) and SUBSTRING( )
Examples:
1) mysql>SELECT SUBSTR('ABCDEFGHIJKLMNOP', -4,3);
+ +
| SUBSTR('ABCDEFGHIJKLMNOP', -4,3) |
+ +
| MNO |
+ 1 row in set (0.00 sec)
2) mysql>SELECT SUBSTR('ABCDEFGHIJKLMNOP', 1,3);
+ +
| SUBSTR('ABCDEFGHIJKLMNOP', 1,3) |
+ +
| ABC |
+ 1 row in set (0.00 sec)
3) mysql>SELECT SUBSTR('ABCDEFGHIJKLMNOP', 4,3);
+ +
| SUBSTR('ABCDEFGHIJKLMNOP', 4,3) |
+ +
| DEF |
+ 1 row in set (0.00 sec)

 LENGTH( ) :
This function returns the number of characters in the given text.
Examples:
1) mysql> SELECT LENGTH('HELLO WORLD');
+ +
| LENGTH('HELLO WORLD') |
+ +
| 11 |
77
+ 1 row in set (0.00 sec)
2) mysql> SELECT LENGTH(' ');
+ +
| LENGTH(' ') |
+ +
| 3 |
+1 row in set (0.00 sec)
3) mysql> SELECT LENGTH(' ');
+ +
| LENGTH(' ') |
+ +
| 1 |
+ +
1 row in set (0.00 sec)

 LEFT( ) :Returns the specified number of characters including space starting


from the leftmost characters.
Parameters required : text, number of characters to be extracted.
Examples:
1) mysql>SELECT LEFT('ABCDEFGHIJKLMNOP',1);
+ +
| LEFT('ABCDEFGHIJKLMNOP',1) |
+ +
|A |
+ 1 row in set (0.00 sec)
2) mysql> SELECT LEFT('ABCDEFGHIJKLMNOP',2);
+ +
| LEFT('ABCDEFGHIJKLMNOP',2) |
+ +
| AB |
+ 1 row in set (0.00 sec)
3) mysql> SELECT LEFT('ABCDEFGHIJKLMNOP',3);
+ +
| LEFT('ABCDEFGHIJKLMNOP',3) |
+ +
| ABC |
+ 1 row in set (0.00 sec)
4) mysql> SELECT LEFT('ABCDEFGHIJKLMNOP',-1);
+ +
| LEFT('ABCDEFGHIJKLMNOP',-1) |
+ +
+ 1 row in set (0.00 sec)
(Note : In the above example , the number of characters to be selected is -1 and
hence characters are not extracted)

78
 RIGHT( ) :Returns the specified number of characters including space starting
from the right of the text.
Parameters required : text, number of characters to be extracted.
Examples:
1) mysql> SELECT RIGHT('ABCDEFGHIJKLMNOP',1);
+ +
| RIGHT('ABCDEFGHIJKLMNOP',1) |
+ +
|P |
+ 1 row in set (0.00 sec)
(Extracting 1 character)
2) mysql> SELECT RIGHT('ABCDEFGHIJKLMNOP',2);
+ +
| RIGHT('ABCDEFGHIJKLMNOP',2) |
+ +
| OP |
+ 1 row in set (0.00 sec)
(Extracting 2 characters)
3) mysql> SELECT RIGHT('ABCDEFGHIJKLMNOP',3);
+ +
| RIGHT('ABCDEFGHIJKLMNOP',3) |
+ +
| NOP |
+ 1 row in set (0.00 sec)
4) mysql> SELECT RIGHT('ABCDEFGHIJKLMNOP',4);
+ +
| RIGHT('ABCDEFGHIJKLMNOP',4) |
+ +
| MNOP |
+ 1 row in set (0.00 sec)
5) mysql> SELECT RIGHT('ABCDEFGHIJKLMNOP',-1);
+ +
| RIGHT('ABCDEFGHIJKLMNOP',-1) |
+ +

 INSTR( ) : Checks whether the second string/text is present in the first string.
If present it returns the starting index.Otherwise returns 0.
Examples:
1) mysql> SELECT INSTR('ABCDEFGHIJKLMNOP','ABC');
+ +
| INSTR('ABCDEFGHIJKLMNOP','ABC') |
+ +
| 1 |
+ 1 row in set (0.00 sec)

79
2) mysql> SELECT INSTR('ABCDEFGHIJKLMNOP','BC');
+ +
| INSTR('ABCDEFGHIJKLMNOP','BC') |
+ +
| 2 |
+ 1 row in set (0.00 sec)
3) mysql> SELECT INSTR('ABCDEFGHIJKLMNOP','EFG');
+ +
| INSTR('ABCDEFGHIJKLMNOP','EFG') |
+ +
| 5 |
+ 1 row in set (0.00 sec)
4) mysql> SELECT INSTR('ABCDEFGHIJKLMNOP','QRST');
+ +
| INSTR('ABCDEFGHIJKLMNOP','QRST') |
+ +
| 0 |
+ 1 row in set (0.00 sec)

 LTRIM( ) :To trim the spaces, if any, from the beginning of the text.
Examples:
1) mysql> SELECT LTRIM(' HELLO');
+ +
| LTRIM(' HELLO') |
+ +
| HELLO |
+

 RTRIM( ) : To trim the spaces, if any, from the end of the text.
Examples:
1) mysql> SELECT RTRIM('HELLO ');
+ +
| RTRIM('HELLO ') |
+ +
| HELLO |
+ 1 row in set (0.00 sec)

2) mysql> SELECT CONCAT(RTRIM('HELLO'), 'WORLD');


+ +
| CONCAT(RTRIM('HELLO '), 'WORLD') |
+ +
| HELLOWORLD |
+ +
1 row in set (0.00 sec)

 TRIM( ): To trim the spaces, if any, from the beginning and end of the text.
Examples:
80
1) mysql> SELECT CONCAT(TRIM('HELLO '), 'WORLD');
+ +
| CONCAT(TRIM('HELLO '), 'WORLD') |
+ +
| HELLOWORLD |
+ + 1 row in set (0.00 sec)

Note: CONCAT( ) combines two strings/texts


2) mysql> SELECT TRIM(' HELLO ');
+ +
| TRIM(' HELLO ') |
+ +
| HELLO |
+ +
1 row in set (0.00 sec)

Try yourself:
Give the output of the following:
1. SELECT POWER(3,3);
2. SELECT POW(3,2);
3. SELECT ROUND(123.45,1);
4. SELECT ROUND(123.45,-1);
5. SELECT ROUND(123.45,0);
6. SELECT ROUND(153.45,2);
7. SELECT ROUND(155.45,0);
8. SELECT ROUND(245,-2);
9. SELECT ROUND(255,- 2);
10. SELECT ROUND(897,3);
11. SELECT ROUND(457,-3);
12. SELECT
ROUND(1567,-3);
13. SELECT RIGHT(‘MORNING’, 2);
14.SELECT MID( TRIM(‘GOOD ‘) , 1,
4);
15. SELECT INSTR( ‘GOOD MORNING’ ,
‘GOOD’ );

Answers
1) 27, 2)9, 3)123.5 4)120, 5)123 6)200, 7)155, 8)200, 9)300, 10)1000, 11)0, 12)2000,
13)NG , 14)GOOD, 15)1

81
Date Functions
1 NOW():- Function that returns the current date and time.

2 DATE():- This function returns the date part from Date and time.

3 MONTH() returns the month part of a date.

4 MONTHNAME() :-gives month name from a date.

5 YEAR():- Date function returns year part of a date.

6 DAY():- Day function provide the day part of Date.

82
7 DAYNAME():- Returns the weekday name of a date.

Aggregate functions:- It perform calculation on multiple values and return a single value. It is also
know as Multi-row functions
List of aggregate functions
MAX(),MIN(),AVG(),SUM(),COUNT()
Aggregate function will not consider NULL values for calculation.
Conside the following table named student.

1 MAX():- returns maximum value from a dataset.

2 MIN():- Returns the minimum value from a dataset.

3 AVG():- Returns the average value from a dataset.

83
4 SUM():- It returns the sum of values in a dataset.

5 COUNT(*):-Will return the total number of rows present in the Table.

6 COUNT( Field Name) will count the number of values(excluding NULL) present in the dataset.

Here answer 4 is displyed even though 5 rows are present in the student table because one NULL
value is present in the column named mark.
Group By clause:- The GROUP BY statement groups rows that have the same values into
summary rows. The GROUP BY statement is often used with aggregate functions ( COUNT() ,
MAX() , MIN() , SUM() , AVG() ) to group the result-set by one or more columns.

Consider the following table named teacher.

1 Write SQL statement to display number of Teacher teahing each subject.


Select count(*) from teacher group by subject;

84
The WHERE clause in MySQL is used with SELECT, INSERT, UPDATE, and DELETE queries to
filter rows from the table or relation. It describes a specific condition when retrieving records from
tables.
2 Display number of employees in each subject whose experience is more than 2.
select count(*) from teacher where experience>2 group by subject;
WHERE clause is coming before group by.

Having Clause
The HAVING clause is often used with the GROUP BY clause to filter rows based on a specified
condition. If we omit the GROUP BY clause, the HAVING clause behaves like the WHERE clause.
1 Display the subject and number of teachers in each subject where group count is more than 1.
select subject, count(*) from teacher group by subject having count(*)>1;
HAVING clause is coming after group by
2 Display details of teacher whose tid more than 3
select * from teacher having tid>3;
OR
select * from teacher where tid>3;
HAVING clause is behaving like WHERE clause in this example.
ORDER BY
Order by clause is used to arrange the rows in Ascending or Descending order of values in a
Column.
1 Display the details of teachers ascending of experience.
select * from teacher order by experience;
OR
select * from teacher order by experience ASC;

2 Display the teachers details in the Descending order of experience.


select * from teacher order by experience DESC;

85
Questions
1. Which of the following would arrange the rows in ascending order in SQL.
a. SORT BY b. ALIGN BY c. GROUP BY d. ORDER BY
2. Prachi has given the following command to obtain the highest marksSelect
max(marks) from student where group by class;
but she is not getting the desired result. Help her by writing the correct command.
a. Select max(marks) from student where group by class;
b. Select class, max(marks) from student group by marks;
c. Select class, max(marks) group by class from student;
d. Select class, max(marks) from student group by class;

3. Help Ritesh to write the command to display the name of the youngest student?
a. select name,min(DOB) from student ;
b. select name,max(DOB) from student ;
c. select name,min(DOB) from student group by name ;
d. select name,maximum(DOB) from student;

4. A relation ‘Vehicles’ is given below :

Write SQLcommands to:


a. Display the average price of each type of vehicle having quantity more than 20.
b. Count the type of vehicles manufactured by each company.
c. Display the total price of all the types of vehicles.

5. Consider the table ‘FANS’ and answer the following.

Write MySQL queries for the following:


a. To display the details of fans in descending order of their DOB
b. To count the total number of fans of each fan mode
c. iv. To display the dob of the youngest fan.

86
6. Write commands in SQL for (i) and (ii) and output for (iii)

(i) To display the details of the store in alphabetical order of name.


(ii) To display the City and the number of stores located in that City, only if the number of
stores ismore than 2.
(iii) SELECT COUNT(STOREID), NOOFEMP FROM STORE GROUP BY NOOFEMP HAVING
MAX(SALESAMT)<60000;

Answers
1. d
2. d
3. b
4
a. select Type, avg(Price) from Vehicle group by Type having Qty>20;
b. select Company, count(distinct Type) from Vehicle group by Company;
c. Select Type, sum(Price* Qty) from Vehicle group by Type;
5.
i. SELECT * FROM FANS ORDER BY FAN_DOB DESC;
ii. SELECT FAN_MODE, COUNT(*) FROM FANS GROUP BY FAN_MODE;
iii. SELECT MAX(FAN_DOB) FROM FANS;

6.
(i) SELECT * FROM STORE ORDER BY NAME;
(ii) SELECT CITY, COUNT(*) FROM STORE GROUP BY STORE HAVING COUNT(*)>2;
(iii) Count(StoreId) | NoOfEmp |
+ + +
|1 | 10 |
|1 | 11 |
|1 | 5 |
|1 | 7 |

87
Worksheet 1
A. Give output of the following:
1. Select Round(546.345, -2);
2. Select Round(546.345, -3);
3. Select Truncate(124.56, 1);
4. Select Truncate(124.56, -2);
5. Select SIGN(-341.45);
6. Select SIGN(0);
7. Select MOD(34,5);
8. Select MOD(6,8);
9. Select MOD(12.6, 8);
10. Select Pow(2,4);
11. Select Char(78,65,77,65,78);
12. Select Char(76.5,65.3,'77.6',65,78);
13. Select Substr('JS09876/XII-H/12',-8,7);
14. Select Trim(Leading 'Pp' from 'PppProgram Features');
15. Select Instr('COORDINATION COMMITTEE ORDER','OR');
16. Select left('COORDINATION COMMITTEE ORDER', length('committee'));
17. Select right('COORDINATION COMMITTEE ORDER', length('committee order'));

B. Write MySQL statements for the following:


I. Display first letter of the provided string in CAPITAL letter and rest all in small letters.
II. Display the phone number 07762227042 in the format (07762)-22-7042.

Worksheet 2
1. select Char(70,65,67,69);
2. select Char(65, 67.3, '69.3');
3. SELECT CONCAT(NAME,dept) AS 'NAME DEPT' FROM Employee;
4. SELECT LOWER(NAME) FROM Employee
5. select substr('ABCDEFGH', 3,4);
6. select substr('ABCDEFGH', -3,4);
7. SELECT UCASE('pqrxyz');
8. SELECT RTRIM('abcdefgh ');
9. select trim(' pqr Periodic Test 1 is over pqr ');
10. select instr('O P JINDAL SCHOOL, KHARSIA ROAD RAIGARH, JINDAL STEEL AND
POWER LIMITED','JINDAL');
11. SELECT LENGTH('O P JINDAL SCHOOL, RAIGARH');
12. SELECT LENGTH(12345 );
13. select left('JS12345/OPJS/XII/A',7);
14. select substr('JS12345/OPJS/XII/A',9,4);
15. select right('JS12345/OPJS/XII/A',5);
88
16. select MOD(23,5);
17. select power(3,4);
18. select ROUND(20.392,1);
19. select sign(-945);
20. select sqrt(25);
21. select truncate(129.345,1);

Worksheet 3
1. select pow(2,3), power(-2,3), pow(3,4);
2. select round(12345.789,2), round(1434.56,-1);
3. select round(62.789),round(6.89,0);
4. select truncate(466.789,1), truncate(645.56,-1);
5. select sqrt(81)+20 from dual;
6. select mod(23,2), mod(78,4);
7. select sign(15,-15), sign(-25), sign(70);
8. select char(65,67,69) from dual;
9. select concat(“info”,”rmatics”);
10. select concat(“ISM -”,concat(“xii”,”I”));
11. select lower(“INFORM”),lcase(“Class XII”);
12. select upper(“Class xii”),ucase(“informatics”);
13. select substring(“India is the Best”,3,2),substr(“Indian”,-2,1);
14. select length(trim(“ abcde defe “));
15. select instr(“Informatics”,”r”);
16. select length(“ab cde fge”);
17. select left(“Informatics”,4) from dual;
18. select right(“Informatics”,6);
19. select mid(“Indian School Muscat”,8,6);
20. Select curdate(), current_date();
21. Select date(now());
22. Select month(now());
23. Select year(“2012-02-21”);
24. Select dayname(now());
25. Select dayofmonth(“2011-03-23”);
26. Select dayofweek(now());
27. Select dayofyear(“2016-02-04”);
28. Select dayofyear(“2012-02-02”);
29. Select NOW(),SLEEP(3),SYSDATE();

89
Index
Unit 3
Introduction to Computer Networks
Consider a standalone computer connected to a printer.

This computer is useful for a particular person at a time. Every time we need to access the files from this PC the
user needs to personally sit by it and work.
Concept of networking – Interconnection of Computers

Now we have connected PC 1 with PC 2. This is the most simple form of a computer network. The data/information
in PC 1 can be accessed from PC 2 and vice-versa. Also printer can be used from both PC 1 and PC 2.

Two or more autonomous computing device connected to one another in order to exchange information or
resources form a computer network.

Advantages of using computer networks

 Resource sharing:-Resource sharing makes it possible to use resources economically, for example, to
manage peripheral devices, such as laser printers, from all connected systems.
 Data separation :-Data separation provides the ability to access and manage databases fromperipheral
workstations that need information
 Separation of software tools:- The separation of software tools provides the possibility of simultaneous
use of centralized, previously installed software tools.
 CPU resource sharing:- With the separation of processor resources, it is possible to usecomputing power
for data processing by other systems that are part of the network.
 Multiuser mode:-The multi-user properties of the system facilitate the simultaneous use of centralized
application software tools previously installed and managed, for example, if the user of the system is
working with another task, then the current work performed is pushed into the background.

Where to connect the network cable while networking and form of cabling

90
The network cable is connected to a RJ-45 connector(RJ – Registered Jack

Evolution of Computer Network - Types of computer network:


There is no single system that satisfies all computer networks. For classification, specific characteristics
are distinguished that allow the networks to be divided into separate types.

The following is the different types of network based on size of computer networks:
PAN
A Personal Area Network (PAN) allows devices to exchange data over short distances. PAN combines devices
such as mice, keyboards, printers, smartphones, tablets, etc. The most common connection technology is
Bluetooth. Bluetooth can give a range of upto 10metres.

LAN

A Local Area Network (LAN) is a computer network that, as a rule, covers a small area, located in one or
morebuildings

The term "local" in this context refers to joint local management (does not mean the mandatory physical
proximity of components to each other). A local network can be a home network, a combination of
computers and other devices of a small office or a large enterprise

91
Wired connections are widely used in LAN, most of which are made using copper wires, and some are fiber—
optic. Usually, wired networks operate at speeds from 100 Mbit/s to 1 Gbit/s. More modern LAN can operate at
a speed of 10 Gbit/s. The most common wired connection standard is the IEEE 802.3 standard, commonly
referred to asEthernet.
In local area networks, along with wired technologies, wireless connections according to the IEEE 802.11
standard,better known as Wi-Fi, are widely used.

Wireless Wi-Fi networks operate at speeds from several to hundreds of megabits per second.
The size of LAN networks ranges from 10metres to 1
KmMAN
Metropolitan area network(MAN) unite computers within a city. As an example, we can consider a cable
television
system in which it became possible to transmit digital data and, over time, the system turned into a
computernetwork.

The size of MAN networks range from 1 Km to

10Km.WAN

The Wide Area Network(WAN) covers significant territories, connects local networks that can be located
in
geographically remote areas. A global network is similar to a large wired local area network, but there are
importantdifferences:

management of local networks and provision of access to the inter-network data transmission environment is
carried out by various organizations;

networks using different types of network technologies can be connected;

with the help of communication channels, individual computers can communicate with local networks, or entire
networks.

The Internet can be considered as a WAN. A WAN ranges from 100km to 10000km.

Network devices
We cannot always make sure that there is a dedicated connection from one computer to another one
in a computer network. Further the data travels over the telephone network. Hence there arises the
92
need for different types of devices in computer networks. Network devices provide transportation of
data that needs to be transferred between end-user devices. They extend and combine cable
connections, convert data from one format to another, and control data transmission. Examples of
devices that perform these functions are repeaters, hubs, switches, and routers.

Network card (NIC/NIU/TAP)


The devices that connect the end user to the network are also called terminal nodes. An example of such
devices is an ordinary personal computer. To work on the network, each host is equipped with a network
Interface card (NIC), also called a network adapter. As a rule, such devices can function without acomputer
network.

A network adapter is a printed circuit board that is inserted into a slot on the motherboard of a
computer, or an external device. Each NIC adapter has a unique code called a MAC address. This
address is used to organize the operation of these devices on the network.
Repeater
Repeaters are network devices operating at the first (physical) level of the OSI reference model. As the
data leaves the sender's device and enters the network, they are converted into electrical or light pulses,
which are then transmitted over the network transmission medium. Such pulses are called signals.
When the signals leave the transmitting station, they are clear and easily recognizable. However, the
longer the cable length, the weaker and less distinguishable the signal becomes as it passes through
the network transmission medium. The purpose of using a repeater is to regenerate and resynchronize
network signals, which allows them to be transmitted over a longer distance through the medium.
Hub
Hub is a network device used to combine devices. The hub can have from 8 to 32 ports for connecting
computers. All the information that comes to the connector of one port will be copied automatically and
sent to ALL other ports. The simplest hub is a multiport repeater.
Router
A router is a network device that facilitates and establishes a connection between a local network and
the Internet by transmitting information to and from packet-switched networks. It performs this function
by analyzing the data packet header, which contains the IP address of the packet destination. Based
on the data packet, the router determines the most efficient route to the destination address. Simply
put, a router routes information between connected networks.
The router is physically connected to the modem and other devices. The router creates a private
network by receiving data from the Internet from the modem, which is connected via cable, DSL or other
wired connection from an Internet service provider. Routers have several ports from which you can
connect to devices to distribute Internet connectivity. By means of communication between modems
and devices in the local network, the router facilitates communication with the Internet and within the
network. The router provides connectivity at the network level of the system and thus functions at the
third level of the OSI model.

93
Working of a Router

This device also performs the functions of the Dynamic Host Configuration Protocol (DHCP), distributing
private IP addresses between devices connected to the network. Routers for home or office have a
private or local address obtained from a reserved range of IP addresses. Devices on the network can
have the same private IP address as devices in the neighbouring house. This is not a problem, since
the devices are separately connected to different routers with a specific public IP address. Thus, the
private IP address functions only so that the router can identify the device.

Gateway

A gateway is considered as a network device that acts as an entry point from one network to another.
The main task of a network gateway is to convert protocol(rules for communicaiton over the data
network) between networks. A network gateway can accept a packet formatted for one protocol (for
example, Apple Talk) and convert it into a packet of another protocol (for example, TCP/IP) before
sending it to another network segment. Network gateways can be a hardware solution, software, or
both, but usually it is software installed on a router or computer. The network gateway must understand
all the protocols used by the router.

Switch

A switch is used to connect computers, laptops and other devices to a shared local network. For example, take a
large company with dozens and hundreds of employees. There is a marketing department, a sales department,
financiers, a director. They need to exchange information, use common tables and programs.Doing this via the
Internet is inconvenient and dangerous (if we talk about observing trade secrets). It is better to combine
working computers into a common closed network, where there is no access tooutsiders. For large video
surveillance systems, switches are also needed. Switches are also used at home.

Switch is also a network device used to connect multiple devices together like Hub. But the difference
between the hub and switch is that hub forward the received messages to all the connecting devices
and switch forward the message to the intended device only. So switch is known as the intelligent
device.
94
Modem modulator / demodulator

A modem is a device that converts a digital signal into an analog signal and vice versa.
The modem connects the user's computer or laptop to the Internet. It works in two
directions at once:
 Receives a digital signal from a PC, converts it to analog (in the form of a
wave)and transmits the request to the servers storing the necessary
information;
 Receives the response to the sent request in analog form, converts it to digital
andtransmits it to the PC

Nowadays the router and modem are combined together in a single device. The device is called a
router.

Addressing of Devices in Computer Networks:


Each network computer has as many as three addresses: physical (MAC address), network (IP address)
and symbolic (regular computer name or full domain name)

To transmit data in local and global networks, the sending device must know the address of the receiving
device. Therefore, each network computer has a unique address, and not one, but as many as three
addresses: physical or hardware (MAC address); network (IP address); symbolic (regular computer
name or full domain name).

95
Physical address of the computer

The physical (hardware) address of the computer depends on the technology with which the network is
built. In Ethernet networks, this is the MAC address of the network adapter. The MAC address is hard-
wired into the network card by its manufacturer and is usually written as 12 hexadecimal digits (for
example, 00-03-BC-12-5D-4E).

This is guaranteed to be a unique address: the first six characters identify the manufacturer, which
ensuresthat the remaining six characters are not repeated on the production line. The MAC address is
selected by the network equipment manufacturer from the address space allocated for it under the
license. When a machine's network adapter is replaced, its MAC address also changes.

You can find out the MAC address of your computer's network card as follows:
1. Go to "Start” – “Run” - enter the command cmd – “OK” from the keyboard.
2. Enter the ipconfig /all command and press Enter.
This command allows you to get complete information about all PC network cards. Therefore, find
the Physical address line in this window – it will indicate the MAC address of your network card.

The network address of the computer

The network address or IP address is used in TCP/IP networks when exchanging data at the network
level. IP stands for Internet Protocol . The computer's IP address is 32 bits long and consists of four
parts called octets. Each octet can take values from 0 to 255 (for example, 90.188.125.200). Octets are
separated from each other by dots.

The IP address of a computer, for example 192.168.1.10, consists of two parts – the network
number (sometimes called the network identifier) and the network computer number (host identifier). The
network number must be the same for all computers on the network and in our example the network
number will be 192.168.1. The computer number must be unique in this network, and the computer in
our example has the number 10.

The IP addresses of computers on different networks may have the same numbers. For example,
computers with IP addresses 192.168.1.10 and 192.168.15.10, although they have the same numbers
(10), but belong to different networks (1 and 15). Since the network addresses are different, computers
cannot be confused with each other.
The IP addresses of computers on the same network should not be repeated. For example, it is
unacceptable to use the same addresses 192.168.1.20 and 192.168.1.20 for two computers on your
local network. This will lead to their conflict. If you turn on one of these computers earlier, when you
turn on the second computer, you will see a message about an erroneous IP address:conflict of IP
addresses with another system on the net in this case, just change the address on one of the computers.

To separate the network number from the computer number, a subnet mask is used. Outwardly, the
subnet mask is the same set of four octets separated by dots. But, as a rule, most of the digits in it are
255 and 0.

If your computer is connected to a local network or the Internet, you can find out its IP address and
subnet mask in a way that is already familiar to us:
1. Go to "Start” – “Run" - type cmd and click OK.

96
2. In the window that opens, enter the ipconfig /all command and press Enter.
You will see the computer's IP address and subnet mask in the corresponding lines:

Internal IP addresses are reserved for local networks (they cannot be accessed via the Internet
without special software) from the ranges:

192.168.0.1 – 192.168.254.254
10.0.0.1 – 10.254.254.254
172.16.0.1 – 172.31.254.254

From these ranges, you, as a system administrator, will assign addresses to computers in your local
network. If you "rigidly" fix the IP address in the computer settings, then such an address will be called
static – it is a permanent, unchangeable IP address of the PC.
There is another type of IP addresses – dynamic, which change every time a computer enters the
network. The DHCP service is responsible for managing the dynamic address allocation process.

Name of the network computer

In addition to physical and network addresses, a computer can also have a symbolic address – the name
of the computer. The computer name is a more convenient and understandable designation for a
computer on the network.

Questions:
1. The length of a network segment in a LAN network is more than 100meteres. Select the device
to beconnected to maintain the strength of signal:
a. Switch
b. Router
c. Gateway
d. Repeater
2. Select the device that helps to transfer the digital signals to be transferred over telephone lines:
a. Switch
b. Modem
c. Gateway
d. Repeater

3. Which of the following devices causes congestion if conneced in a Computer Network?


a. Switch
b. Modem
c. Gateway
d. Hub
97
4. The System Administrator at Gyan international school wants to connect the LAN network at the
schoolto the internet. Help him to choose the correct device for the job:
a. Switch
b. Repeater
c. Router
d. Hub
5. The Gyan international school has installed 40 computers in its Computer lab. Choose the correct
deviceto form a LAN network involving the 40 computers.
a. Switch
b. Repeater
c. Gateway
d. Hub
6. The device used to connect two networks using different protocols is:
a. Router
b. Repeater
c. Gateway
d. HUB
7. The connector used for networking is:
a. RJ - 11
b. RI – 11
c. RJ - 45
d. RI- 45
8. What is the difference between a Hub and a Switch?
9. What is the difference between a Router and a Gateway ?
10. Why switch is called an intelligent device”

Solutions:

1. d. Repeater – The repeater amplifies the input signal to make up the loss in strength.
2. b. Modem – Modulator-Demodulator converts digital signal to anlog and vice-versa.
3. d. Hub -
4. c. Router
5. a. Switch
6. c. Gateway
7. c. RJ – 45 . RJ stands for Registered Jack.
8. The hub receives network data on one port and simply send information to all
devicesConnected to it. Such data transmission has disadvantages:
a. Heavy load on the network (data is sent to all computers on the
network at once);
b. A large number of errors, especially when new computers appear;
c. It is impossible to separate the flows of information, to send it in a targeted manner.

9.A gateway is a network device that allows a network to communicate with another network with other
protocols (rules for communication). Gateways act as a network point that acts as an entrance to another
network. A router connects two or more data lines, so when a packet arrives through one line, the router
98
reads the packet address information and determines the correct
destination. These days, routers are mostly available with built-in gateway systems, making it easier for
users who don't need to buyseparate systems.
10.Switch forward the message to the intended user only. It does not use the broadcast technology

Networking Topologies:

Topologies: The arrangement of computers and other peripherals in a network is called its topology.
Common network topologies are bus, star mesh, and tree

Bus Topology

In bus topology all the nodes are connected to a main cable called backbone. If any node has to send some
information to any other node, it sends the signal to the backbone. The signal travels through the entire length of
the backbone and is received by the node for which it is intended. A small device called terminator is attached at
each end of the backbone. When the signal reaches the end of backbone, it is absorbed by the terminator and the
backbone gets free to carry another signal.

Characteristics of Bus topology:


 It is easy to install.
 It requires less cable length
 It is cost effective.
 Failure of a node does not affect the network.
 Fault diagnosis is difficult.
 At a time only one node can transmit data.

Star Topology:
In star topology each node is directly connected to a hub/switch. Star topology generally requires more
cable than bus topology.

Characteristics of Star topology:


 It is more efficient topology
 It is easy to install
 It is easy to diagnose the fault
 It is easy to expand
 Failure of hub/switch leads to failure of entire network
 It requires more cable length

Tree Topology:
Tree topology is a combination of bus and star topologies. It is used to combine multiple star topology

99
networks. All the stars are connected together like a bus.

Characteristics of Tree topology:


 It offers easy way of network expansion.
 If one network (star) fails, the other networks remain connected and working.

Mesh Topology :
In this networking topology, each communicating device is connected with every other device in the
network. To build a fully connected mesh topology of n nodes, requires n(n-1)/2 wires.

Characteristics of Mesh topology:


 Failure during a single device won’t break the network.
 There is no traffic problem.
 It provides high privacy and security.
 A mesh doesn’t have a centralized authority.
 It’s costly.
 Installation is difficult

BUS STAR

TREE MESH

100
Introduction to Internet:

The Internet is the global network of computing devices including desktop, laptop, servers, tablets, mobile
phones, other handheld devices as well as peripheral devices such as printers, scanners, etc. In addition, it
consists of networking devices such as routers, switches, gateways, etc. Today, smart electronic applianceslike
TV, AC, refrigerator, fan, light, etc., can also communicate through the Internet.

Applications of Internet
• The World Wide Web (WWW)
• Electronic mail (Email)
• Chat
• Voice Over Internet Protocol (VoIP)

The World Wide Web (WWW): The World Wide Web (WWW) or web in is information stored in
interlinked web pages and web resources. The resources on the web can be shared or accessed through the
Internet.Three fundamental technologies HTML,URL and HTTP leads to creation of web.

URL : A Uniform Resource Locator (URL) is a standard naming convention used for accessing resources over the
Internet. URL is sometimes also called a web address. In below URL, http is the protocol name, it can be
https, http, FTP, Telnet, etc. www is a sub domain. ncert.nic.in is the domain name

Electronic mail (Email) : Electronic mail is a means of sending and receiving message(s) through
the Internet. The message can be either text entered directly onto the email application or an attached file
(text, image audio, video, etc.) stored on a secondary storage. To use email service, one needs to register
with an email serviceprovider by creating a mail account.

Chat : Chatting or Instant Messaging (IM) is communicating in real time using text message(s).

Voice Over Internet Protocol (VoIP): Voice over Internet Protocol (VoIP) allows you to have
voicecalls over digital networks.

Points To Rember :

 In Bus topology Nodes connected using single wire, cost effective, easy to install and fault
diagnoseis difficult.
 In star topology each Nodes is directly connected to hub/switch easy to install, expensive and
easyto diagnose faults.
 Tree is combination of star and bus.

101
 Mesh topology each device is connected to every other device. No centralized
device, andexpensive
 WWW (World Wide Web )where documents and other web resources are identified by
UniformResource Locator.
 URL is a reference to a web resource that specifies its location on a computer network
and amechanism for retrieving it.
 Chat is real time texting.
 VoIP allows voice calls.

Questions:
1. Physical arrangement of computers in a network is called network is called .
2. In topology all the nodes are connected to a single cable.
3. Network topology in which you connect each node to the network along a single piece of
cable iscalled
4. In Topology, a dedicated link connects device to central controller
5. In Star topology if central hub fails, it effects
a. No effects b. Entire system c. Particular Node
6. Which of the following topologies is a combination of more than one topologies?
a. Bus b. Tree c. Star d. None of these
7. Identify the type of topology from the following:
a) Each node is connected with the help of a single cable.
b) Each node is connected with central switching through independent cables.
8. Illustrate the layout for connecting 5 computers in a Bus and a Star topology of Networks.
9. Identify valid URL from the following
a. http://www.cbse.nic.in/welcome.htm, b . www.cbse.nic.in/ http://welcome.htmc . http://
welcome.htm
10. Identify the protocol from the following .http://www.cbse.nic.in/welcome.htm
11. Guru wants to send a report on his trip to the North East to his mentor. The report contains images and
videos. How can he accomplish his task through the Internet?
12. URL stands for
13. VoIP stands for
14. Name the protocol allows to have the voice call over the Internet
15. Which of the following will you suggest to establish the real-time textual communication
between thepeople.
a. E-mail
b. Video Conferencing
c. Chatting
d. Real time communication is not possible

Answers:

1. Topology
2. Bus.
3. Bus
4. Star
5. Entire system
102
6. Tree
7. (a). BUS (b). Star
8.

9. http://www.cbse.nic.in/welcome.htm
10. http
11. E-mail
12. Uniform Resource locator
13. Voice over Internet Protocol
14. VoIP
15. Chatting

Website:-
Website is a group of web pages, containing text, images and all types of multi-
mediafiles
Difference between Website and Webpage
Website WebPage
A collection of web pages which A document which can be displayed
are grouped together and usually in a web browser such as Firefox,
connected together in various Google Chrome, Opera, Microsoft
ways, Often called a "web site" or Internet Explorer etc
simply a "site. Result web page of CBSE
Eg: CBSE website
Contains information about Contents information about single
various topics topic
Web Site address doesn’t depend Depends upon web page address
upon webpage address
Development time is more Less Development time required

Difference between Static and Dynamic webpage

Static webpage content is constant The page content changes


in all time according to the user.
Loading time is less Loading time is more
No database is used A database is used in the server side
103
Content changes rarely Content changes constantly
Web Server :-
A web server is a computer that stores web server software and a website's
component files (e.g. HTML documents, images, CSS style sheets, and JavaScript
files).When client sends request for a web page, the web server search for the
requested page if requested page is found then it will send it to client with an
HTTP response. If the requested web page is not found, web server will the send
an HTTP response :Error 404 Not found.

Web Hosting :-
Web hosting is an online service that enables you to publish your website or web
application on the internet. When you sign up for a hosting service, you basically
rent some space on a server on which you can store all the files and data necessary
for your website to work properly. A server is a physical computer that runs without
anyinterruption so that your website is available all the time for anyone who wants
to see it
Web Browser :- A web browser, or simply "browser," is an application used to
access and view websites. Common web browsers include Microsoft Internet
Explorer, Google Chrome, Mozilla Firefox, and Apple Safari.
Add-ons( in terms of Hardware): An Add-on is either a hardware unit that can be
added to a computer to increase the capabilities or a program unit that enhances
primary program. Some manufacturers and software developers use the term add-
on. Examples of add-ons for a computer include card for sound, graphic acceleration,
modem capability and memory. Software add- on are common for games,
wordprocessing and accounting programs
Plug-ins:- a plug-in (or plugin, add-in, add-on) is a software component that adds a
specific feature to an existing computer program. When a program supports plug-

104
ins, it enables customization. Plug-ins are commonly used in Internet browsers but
alsocan be utilized in numerous other types of applications
Cookies :- cookies are small files which are stored on a user’s computer and contains
information like which Web pages visited in the past, logging details Password etc.
They are designed to hold a small amount of data specific to a particular client and
website and can be accessed by the web server or the client computer

Multiple choice questions:

1.A website is a collection of


(a) HTML documents (b) Graphic files (c)Audio and video files (d)All of the
above

2. The first page that we normally view at a website is called (a)Home page
(b)Webpage (c) Webserver (d)Email

3. Which of the following is not a web browser?


(a) Google Chrome (b) Mozilla Firefox (c)Opera (c)MS word

4. Which of the following is a web browser?


(a) Adobe Photoshop (b) Coral Draw (c) Apple Safari (d) MS word

5. Which of the following button allows you to move to the previously visited
page onthe browser?
a) Back (B)Previous (c) Last (d)Reverse
6. Which of the following is peace of information stored in a form of a text file and
thathelps in customizing the displayed information, login, showing data based
on user’sinterests from the web site?
(a) Extension (b) Cookies (c)Login (d)Session

7. The space provided by a service provider to store website data is called


.
(a) Webspace (b)Cloud Computing (c)Web Hosting (d)Web Store
8. is an online service that enables you to publish your website or
webapplication on the internet
(a) Web server (b) Web Browser (c)Web Hosting (d) None
9. is a a software component that adds a specific feature to an
existingcomputer program
105
(a) Addon (b)Plug in (c) Cookies (d) All of the above

10. The first page on the website that allows you to navigate to other pages by
menusor links is known as
(a) front page (b)primary page (c)Home page (d)

NoneFill in the blanks questions:-

1. A is a collection of web pages written using HTML.

2. A computer on which the website is hosted and it is connected to the


internet alltime is known as .
3. The of a website are linked together with different hyperlinks and
share acommon interface and design.
4. An interactive web page is created through
5. The space provided by a service provider to store website data is called _____

Answers
Multiple choice questions:
1.a. 2.a 3. c 4 .c 5.a 6.b 7c 8.c 9,b 10.c
Fill in the blanks:
1. Website 2.Web server 3.Web pages 4.HTML and scripting
languages 5.WebHosting

Descriptive Questions and answers:


1. Differentiate between web browser and web
serverWeb Server :-
A web server is a computer that stores web server software and a website's
component files (e.g. HTML documents, images, CSS style sheets, and JavaScript
files).When client sends request for a web page, the web server search for the
requested page if requested page is found then it will send it to client with an
HTTP response. If the requested web page is not found, web server will the send
an HTTP response
:Error 404 Not
found.Web
Browser :-
106
A web browser, or simply "browser," is an application used to access and view
websites. Common web browsers include Microsoft Internet Explorer, Google
Chrome,Mozilla Firefox, and Apple Safari

2. Differentiate between eb page and home page?


Web page:- A document using http and resides on a website is called
webpageHome page:-It is the page that gets displayed first when we open
a webpage.

3. Differentiate between dynamic and static


webpages?Ans:
Static webpage content is constant The page content changes
in all time according to the user.
Loading time is less Loading time is more
No database is used A database is used in the server side
Content changes rarely Content changes constantly

4. Write the steps to host a


website:;Ans:-
Following steps needs to followed to host a website:

1. Go and search for the hosting provider companies online


2. Find a suitable domain name for your website
3. Register your domain name with the Domain Name Registrar
4. Once you get to space, create your login
5. Upload your localhost website files on the allocated space
6. Map you domain name with IP address
7. What are the components of a web site? Explain in detail.

1. Webhosting – A space or computer provided by a service provider to store


websitedata
2. Address – A unique URL rendered by the browser when the request sent by the
user
3. Homepage – The first page of a website when the website is launched
4. Design – The theme and interface design including the layout of the website
5. Content – The text, images, links, and other media files included in the web page
6. Navigation Structure – A structure that navigates from one page to another
7. Explain the following terms:
107
(a)Website (b) Webpage (c) Homepage (d)Webserver

Web Site Web Page Home Page Web Server


A document The top level A web server is a
Group of related that uses HTTP page of web computer that
web pages site stores web
hosted on a web server software
server and a website's
component files
(e.g. HTML
documents,
images, CSS style
sheets, and
JavaScript files)

Website:-
Website is a group of web pages, containing text, images and all types of multi-mediafiles.
Some examples of websites:
 Google.com
 cbse.nic.in
 Amazon.com
 Wikipedia.org

Difference between Website and Webpage

Website WebPage
A collection of web pages which are A document which can be displayed in a
grouped together and usually connected web browser such as Firefox, Google
together in various ways, Often called a Chrome, Opera, Microsoft Internet Explorer
"web site" or simply a "site. etc
Eg: CBSE website Eg: Result web page of CBSE
A webpage is commonly written in HTML

Contains information about various Contents information about single topic


topics
Web Site address doesn’t depend Depends upon web page address
upon webpage address
Development time is more Less Development time required

108
Difference between Static and Dynamic webpage

Static Web page Dynamic webpage


Static webpage content is constant all The page content changes according to
the time the user.
Loading time is less Loading time is more
No database is used A database is used in the server side
Content changes rarely Content changes frequently
Less complex Complex

Web Server :-

A web server is a computer that stores web server software and a website's component files
(e.g. HTML documents, images, CSS style sheets, and JavaScript files). When client sends
request for a web page, the web server search for the requested page. If requested page is
found then it will send it to client with an HTTP response, if the requested web page is not
found, web server will the send an HTTP response: Error 404 Not found.

Web Hosting :-

Web hosting is an online service that enables you to publish your website or web application
on the internet. When you sign up for a hosting service, you basically rent some space on a
server on which you can store all the files and data necessary for your website to work properly.
A server is a physical computer that runs without any interruption so that your website is
available all the time for anyone who wants to see it.

Web Browser: - A web browser, or simply "browser," is an application used to access and
view websites. Common web browsers include Microsoft Internet Explorer, Google Chrome,
Mozilla Firefox, Opera and Apple Safari.

Add-ons (in terms of Hardware): An Add-on is either a hardware unit that can be added to a
computer to increase the capabilities or a program unit that enhances primary program. Some
109
manufacturers and software developers use the term add-on. Examples of add-ons for a
computer include card for sound, graphic acceleration, modem capability and memory.
Software add- on are common for games, wordprocessing and accounting programs. Software
add-ons will integrate to the browser and it only run when the browser runs.

Plug-ins: - a plug-in (or plugin, add-in, add-on) is a software component that adds a specific
feature to an existing computer program. When a program supports plug-ins, it enables
customization. Plug-ins are commonly used in Internet browsers but also can be utilized in
numerous other types of applications. An example of a plugin is the free Macromedia Flash
Player, a plugin that allows the web browser to display animations using the Flash format.
Note: Plug-in is a complete program where add-on is not a complete program.

Cookies: - cookies are small text files which are stored on a user’s computer and contain
information like which Web pages visited in the past, logging details Password etc. They are
designed to hold a small amount of data specific to a particular client and website and can be
accessed by the web server or the client computer.

Multiple choice questions:

1. A website is a collection of
(b) HTML documents (b) Graphic files (c)Audio and video files (d)All of the above

2. The first page that we normally view at a website is called (a)Home page
(b)Webpage (c) Webserver (d)Email

3. Which of the following is not a web browser?


(b) Google Chrome (b) Mozilla Firefox (c)Opera (d)MS word

4. Which of the following is a web browser?


(c) Adobe Photoshop (b) Coral Draw (c) Apple Safari (d) MS word

5. Which of the following button allows you to move to the previously visited page onthe
browser?
(d) Back (B)Previous (c) Last (d)Reverse

6. Which of the following is peace of information stored in a form of a text file and that helps in
customizing the displayed information, login, showing data based on user’s interests from
the web site?
(e) Extension (b) Cookies (c)Login (d)Session

7. The space provided by a service provider to store website data is called


.
(f) Webspace (b)Cloud Computing (c)Web Hosting (d)Web Store

8. _ is an online service that enables you to publish your website or web


110
application on the internet
(g) Web server (b) Web Browser (c)Web Hosting (d) None

9. is a software component that adds a specific feature to an existing


computer program
(h) Add on (b)Plug in (c) Cookies (d) All of the above

10. The first page on the website that allows you to navigate to other pages by menus or links
is known as
(i) front page (b)primary page (c)Home page (d) None
Fill in the blanks questions:-
1. A is a collection of web pages written using HTML___________

2. A computer on which the website is hosted and it is connected to the internet all time
is known as .
3. The of a website are linked together with different hyperlinks and share a
common interface and design.
4. An interactive web page is created through
5. The space provided by a service provider to store website data is called ______
6. The ____________ is an application program that is used to view the web pages.

Answers
Multiple choice questions:
1.a. 2.a 3. d 4 .c 5.a 6.b 7c 8.c 9.b 10.c
Fill in the blanks:
1. Website 2.Web server 3.Web pages 4.HTML and scripting languages
5. WebHosting 6. Web browser
Descriptive Questions and answers:-
5. Differentiate between web browser and web server Web Server-
A web server is a computer that stores web server software and a website's
component files (e.g. HTML documents, images, CSS style sheets, and JavaScript
files). When client sends request for a web page, the web server search for the
requested page if requested page is found then it will send it to client with an HTTP
response. If the requested web page is not found, web server will the send an HTTP
response
: Error 404 Not found.
Web Browser:-
A web browser, or simply "browser," is an application used to access and view
websites. Common web browsers include Microsoft Internet Explorer, Google Chrome,
Mozilla Firefox, and Apple Safari
6. Differentiate between web page and home page?

111
Web page:- A document created usually using HTML and resides on a
website is called webpage
Home page:-It is the first page that gets displayed when we open a website
7. Differentiate between dynamic and static webpages?
Static webpage content is The page content changes
constant in all time according to the user.
Loading time is less Loading time is more
No database is used A database is used in the server side
Content changes rarely Content changes frequently
8. Write the steps to host a website:;
Following steps needs to followed to host a website:

 Go and search for the hosting provider companies online


 Find a suitable domain name for your website
 Register your domain name with the Domain Name Registrar
 Once you get to space, create your login
 Upload your local host website files on the allocated space
 Map you domain name with IP address
6. What are the components of a web site? Explain in detail.
 Webhosting – A space or computer provided by a service provider to store website
data
 Address – A unique URL rendered by the browser when the request sent by the user
 Homepage – The first page of a website when the website is launched
 Design – The theme and interface design including the layout of the website
 Content – The text, images, links, and other media files included in the web page
 Navigation Structure – A structure that navigates from one page to another
6.Explain the following terms:

(a)Website (b) Webpage (c) Homepage (d)Webserver


Web Site Web Page Home Page Web Server
A document that uses The top level page of A web server is a
Group of related HTTP web site computer that stores
web pages web server software
hosted on a web and a website's
server component files (e.g.
HTML
documents, images,
CSS style sheets, and
JavaScript files)

112
Index
UNIT 4
SOCIETAL IMPACTS
● Digital footprint, net and communication etiquettes,
● Data protection, intellectual property rights (IPR), plagiarism, licensing and copyright,
● Free and open source software (FOSS),
● Cybercrime and cyber laws, hacking, phishing, cyber bullying, overview of Indian IT Act.
● E-waste: hazards and management. Awareness about health concerns related to the usage of
technology.
DIGITAL FOOTPRINT

A digital footprint – refers to the trail of data you leave while using the internet. It includes websites
you visit, emails you send, and information you submit online. A digital footprint can be used to
track a person’s online activities and devices.

Internet users create their digital footprint either actively or passively. 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

Digital footprint examples

Online shopping
● Making purchases from e-commerce websites
Online banking
● Using a mobile banking app
Social media
● Using social media on your computer or devices
● Sharing information, data, and photos with your connections
Reading the news
● Subscribing to an online news source
Health and fitness
● Using fitness trackers
● Using apps to receive healthcare
NETIQUETTE
It is the abbreviation of Internet etiquette or network etiquette, refers to online manners while
using internet or working online. While online you should be courteous, truthful and respectful of
others. It includes proper manners for sending e-mail, conversing online, and so on.

113
Some basic rules of netiquette are:
● Be respectful
● Think about who can see what you have shared.
● Read first, then ask
● Pay attention to grammar and punctuation
● Respect the privacy of others
● Do not give out personal information

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.
Data Privacy v/s Data Protection
For data privacy, users can often control how much of their data is shared and with whom. For
data protection, it is up to the companies handling data to ensure that it remains private. Data
privacy is focused on defining who has access to data while data protection focuses on applying
those restrictions.
How we can protect our personal data online
● Through Encrypt our Data
● Keep Passwords Private
● Don't Overshare on Social Networking Sites
● Use Security Software
● Avoid Phishing Emails
● Be Wise About Wi-Fi
● Be Alert to Impersonators
● Safely Dispose of Personal Information

INTELLECTUAL PROPERTY RIGHTS (IPR)

Intellectual Property (IP) – is a property created by a person or group of persons using their own
intellect for ultimate use in commerce and which is already not available in the public domain.
Examples of Intellectual Property :- an invention relating to a product or any process, a new
design, a literary or artistic work and a trademark (a word, a symbol and / or a logo, etc.)

Intellectual Property Right (IPR) is the statutory right granted by the Government, to the owner(s)
of the intellectual property or applicant(s) of an intellectual property (IP) to exclude others from

114
exploiting the IP commercially for a given period of time, in lieu of the discloser of his/her IP in an
IPR application.

Copyright laws protect intellectual property


Copyright It is a legal concept, enacted by most governments giving creator of original work
exclusive rights to it, usually for a limited period.
Copyright infringement – When someone uses a copyrighted material without permission, it is
called Copyright infringement.
Patent – A patent is a grant of exclusive right to the inventor by the government. Patent give the
holder a right to exclude others from making, selling, using or importing a particular product or
service, in exchange for full public disclosure of their invention.
Trademark – A Trademark is a word, phrase, symbol, sound, colour and/or design that identifies
and distinguishes the products from those of others.

PLAGIARISM

Plagiarism It is stealing someone’s intellectual work and representing it as your own work without
citing the source of information.
Any of the following acts would be termed as Plagiarism:
● Using some other author’s work without giving credit to the author
● Using someone else’s work in incorrect form than intended originally by the author or
creator.
● Modifying /lifting someone’s production such as music composition etc. without attributing
it to the creator of the work.
● Giving incorrect source of information.

LICENSING AND COPYRIGHT

Licenses are the permissions given to use a product or someone’s creation by the copyright
holder.
Copyright is a legal term to describe the rights of the creator of an original creative work such as
a literary work, an artistic work, a design, song, movie or software etc.

FREE AND OPEN-SOURCE SOFTWARE (FOSS)

OSS refers to Open Source Software, which refers to software whose source code is available to
customers and it can be modified and redistributed without any limitation.

Free and open-source software (FOSS) is software that can be classified as both free software
and open-source software. That is, anyone is freely licensed to use, copy, study, and change the
software in any way, and the source code is openly shared so that people are encouraged to
voluntarily improve the design of the software.

115
CYBER CRIME

Any criminal or illegal activity through an electric channel or through any computer network is
considered as cyber crime.
Eg: Cyber harassment and stalking, distribution of child pornography,types of spoofing, credit card
fraud ,. etc

CYBER LAW
It is the law governing cyberspace which includes freedom of expression, access to and usage of
internet and online privacy.
The issues addressed by cyber law include cybercrime, e-commerce, IPR and Data protection.

HACKING:
It is an act of unauthorised access to a computer, computer network or any digital system.
Hackers usually are technical expertise of hardware and software.
● Hacking when done with a positive intent is called as Ethical hacking or White hat.
● Hacking when done with a negative intent is called as Unethical hacking or Black hat.

PHISHING:
It is an unlawful activity where fake websites or emails appear as original or authentic .This sites
when clicked by the user will collect sensitive and personal details like usernames, password,
credit card details etc.

CYBER BULLYING:
It is the use of technology to harass , threaten or humiliate a target .
Example: sharing of embarrassing photos or videos, posting false information, sending mean
text., etc.

OVERVIEW OF INDIAN IT ACT:


The Government of India’s – Information Technology Act, 2000 (also known as IT Act) , amended
in 2008, provides guidelines to the user on the processing , storage and transmission of sensitive
information

E-waste - HAZARDS AND MANAGEMENT:


Various forms of electric and electronic equipment which no longer satisfy their original purpose
are termed as Ewaste. This includes Desktop, Laptop, Projectors, Mobiles,etc
● HAZARDS:It consists of mixtures of various hazardous organic and inorganic materials
which when mixed with water/soil may create threat to the environment.
● MANAGEMENT: Sell back, gift/donate, reuse the parts giveaway to a certified e-waste
recycler

116
ABOUT HEALTH CONCERNS RELATED TO THE USE OF TECHNOLOGY:
There are positive as well as negative impact on health due to the use of these technologies.
● POSITIVE IMPACT
▪ Various health apps and gadgets are available to monitor and alert
▪ Online medical records can be maintained
● NEGATIVE IMPACT
▪ One may come across various health issues like eye strain, muscle problems, sleep
issues,etc
▪ Anti social behaviour, isolation, emotional issues, etc.

OBJECTIVE TYPE QUESTIONS(1 mark)

1. A copyright is automatically granted to authors or creators of content. (True/False)


2. In FOSS source code is usually hidden from the users. (True/False)
3. The practice of taking someone else's work or ideas and passing them off as one's own is
known as _____________
4. A mail or message sent to a large number of people indiscriminately without their consent is
called____________
5. Receiving irreleavnt and unwanted emails repeatedly is an example of ______________.
6. The generally recognized term for the government protection afforded to intellectual property
(written and electronic) is __________.
7. A software which can be freely accessed and modified is called ___________
8. Freeware is copyrighted software that is freely available to use.(True/False)
9. _______ is a secure technique to protect data being transmitted over a network.
10. ________ are the etiquettes that are to be followed while communicating online.

MULTIPLE CHOICE QUESTIONS

1. 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

2. Ankit made a ERP - Enterprise resource planning solution for a renowned university and
registered and Copyrights for the same. Which of the most important option; Ankit got the
copyrights.
a) To get society status
b) To get fame
c) To get community welfare
d) To secure finance protection
117
3. Which of the following is not an example of Social media platform?

a. Facebook
b. Pinterest
c. Google+
d. Social channel

4. A responsible netizen must abide by __________


a. Net etiquettes
b. Communication etiquettes
c. Social media etiquettes
d. All of the above

5. A ___________ is some lines of malicious code that can copy itself and can
have detrimental effect on the computers, by destroying data or corrupting the
system.
a. Cyber crime
b. Computer virus
c. Program
d. Software

6. 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 a friend
d) None of the above

7. You are planning to go for a vacation. You surfed the internet to get answers for following
queries.
a) Places to visit
b) Availability of air tickets and fares
c) Best hotel deals
d) All of these
Which of the above-mentioned actions might have created a digital footprint?

8. Legal term to describe the rights of a creator of original creative or artistic work is called……..
a) Copyright
b) Copyleft
c) GPL
d) BSD

9. Intellectual Property is legally protected through ____


118
a) copyright
b) patent
c) registered trademark
d) All of the above

10. _____________ includes any visual symbol, word, name, design, slogan, label, etc., that
distinguishes the brand from other brands.
a) Trademark
b) Patent
c) Copyright
d) None of the above

11. Gaining unauthorised access to a network or computer aur digital files with malicious
intentions, is
called_________
a. Cracking
b. Hacking
c. Banging
d. Phishing

12. Legal term to describe the rights of a creator of original creative or artistic work is called
_____
a. Copyright
b. Copyleft
c. GPL
d. None of these

13. OSS stands for


a. Open system security
b. Open system source
c. Open software and security
d. Open source software

14.Any fraudulent business practice that extracts money e from an unsuspecting, ignorant
person is called_______
a. Stealing
b. Scam
c. Violation of copyright
d. Digital footprint

15.________ means no price is to be paid for the software.


a. Free software
119
b. Freeware
c. shareware
d. Open source software

16.Any work / information that exist in digital form idea on internet or on an electronic device, is
known as________________ property.
a. Licence property
b. digital property
c. source code property
d. software property

17.Discarded electrical or or electronic devices are known as____________.


a. E waste
b. Software Waste
c. Hardware waste
d. Computer waste

18.The least restrictive open sourcelicence is________ licence.


a. Apache Licence
b. MIT licence
c. GNU licence
d. BSD licence

19. The original code written by programmers for a software is known as______________
a. Object code
b. Source code
c. Python code
d. Language code

20. ____________ means freedom to use the software.


a. Plagiarism
b. Freeware
c. Open software
d. Free software

21. IAD means _________________


a. Internet advanced data
b. Internet addiction disorder
c. Internet advanced digitalization
d. Internet aggregate data

22. The__________ is the Digital trail of your activity on the internet.


a. Copyleft
b. Digital footprint
120
c. Digital data
d. Internet property

23.The ________ the are the permissions given to use a product or someone's creator by the
copyright holder.
a. Source code
b. Licence
c. Software authority
d. Digital rights

24._____________ is a licence that gives right opposite to copyright.


a. Left copy
b. Digital copy
c. Copyleft
d. IPR

25. A software that can be freely accessed and modified is called


a. synchronous software
b. package software
c. open source software
d. middleware.

26.Which of the following is an advantage of open source software?


a. You can edit the source code to customise it
b. you need to be an expert to edit code
c. you have to pay
d. can sometimes with two generic for specialist purposes.

27.Which of the following is a disadvantage of open source software?


a. high quality software with lots of features.
b. not as customizable
c. may not have been tested as much as proprietary software so might have bugs.
d. you can added the source code to customize it

28.Which of the following is an advantage of proprietary software?


a. It is usually free
b. thoroughly tested because people are paying to use it.
c. Not as customizable.
d. Can sometimes be to generate for specialist purposes.

29.Which of the following is a disadvantage of proprietary software?


a. You need to be an expert to edit code.
b. You have to pay for this type of software.
c. It’s licensed.
121
d. It is launched after proper testing.

30.The generally recognized term for the government protection afforded to intellectual property
written
and electronic is called _____________
a. Computer security law.
b. Aggregate information.
c. Copyright law
d. Data security standards.

31.Which of the following would be a creative work protected by copyright?


a. A list of all Indian President names
b. A Portrait of your family
c. A song you wrote
d. The name of your pet dog

32.Which of the following is not done by cyber criminals?


a. Unauthorised account access
b. Mass Attack using trojans as botnets
c. Email spoofing and spamming
d. report vulnerabilty in any system

33.What is the name of the IT law that India is having in the Indian legislature?
a. India's Technology IT Act 2000
b. India's Digital information technology DIT Act, 2000
c. India's Information Technology IT Act, 2000
d. The technology act, 2008.

34.What is meant by the term cybercrime?


a. Any crime that uses computers to jeopardize or attempt to jeoparadise in national security
b. The use of computer networks to commit financial or identity fraud
c. The theft of Digital information
d. Any crime that involves computers and networks

35.Every activity you perform on the internet is safe for how long?
a. 1 month
b. 1 year
c. As per my setting
d. Forever

36.A _____________ is an injury or disorder of muscles, nerves, tendons, ligaments and joints.
a. Repetitive Strain injury
b. Muscle injury
c. Nervous breakdown
122
d. Joint pain
.
37.________________ is a technology related health condition affecting eyesight.
a. Computer vision strain
b. Computer vision syndrome
c. Eyesight syndrome
d. Vision imbalance

CASE STUDY BASED QUESTIONS


1. After practicals, Atharv left the computer laboratory but forgot to sign off from his email
account. Later, his classmate Revaan started using the same computer. He is now logged in as
Atharv. He sends inflammatory email messages to few of his classmates using Atharv’s email
account. Revaan’s activity is an example of which of the following cyber crime?
a) Hacking
b) Identity theft
c) Cyber bullying
d) Plagiarism

2. Rishika 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 Rishika to
do?
a) Inform Garvit so that he may change his password.
b) Give the password of Garvit’s email ID to all other classmates.
c) Use Garvit’s password to access his account.

3. Suhana is down with fever. So, she decided not to go to school tomorrow. Next day, in the
evening she called up her classmate, Shaurya and enquired about the computer class. She also
requested him to explain the concept. Shaurya said, “Mam taught us how to use tuples in
python”. Further, he generously said, “Give me some time, I will email you the material which will
help you to understand tuples in python”.
Shaurya quickly downloaded a 2-minute clip from the Internet explaining the concept of tuples in
python. Using video editor, he added the text “Prepared by Shaurya” in the downloaded video
clip. Then, he emailed the modified video clip to Suhana. This act of Shaurya is an example of

a) Fair use
b) Hacking
c) Copyright infringement
d) Cyber crime

4. After a fight with your friend, you did the following activities. Which of these activities is not an
example of cyber bullying?

123
a) You sent an email to your friend with a message saying that “I am sorry”.
b) You sent a threatening message to your friend saying “Do not try to call or talk to me”.
c) You created an embarrassing picture of your friend and uploaded on your account on a social
networking site.

5. Sourabh has to prepare a project on “Digital India Initiatives”. He decides to get information
from the Internet. He downloads three web pages (webpage 1, webpage 2,webpage 3)
containing information on Digital India Initiatives. Which of the following steps taken by Sourabh
is an example of plagiarism or copyright
infringement?
a) He read a paragraph on “Digital India Initiatives” from webpage 1 and rephrased it in his own
words. He finally pasted the rephrased paragraph in his project.
b) He downloaded three images of “Digital India Initiatives” from webpage 2. He made a collage
for his project using these images.
c) He downloaded “Digital India Initiative” icon from web page 3 and pasted it on the front page
of his project report.

6. Neerja is a student of Class XI. She has opted for Computer Science. Neerja prepared the
project assigned to her. She mailed it to her teacher. The snapshot of that email is shown below.

Find out which of the following email etiquettes are missing in it.
a) Subject of the mail
b) Formal greeting
c) Self-explanatory terms
d) Identity of the sender
e) Regards

7. You are planning to go on a vacation to Kashmir. You surfed the internet for the following:
i) Weather conditions
ii) Availabilty of air tickets and fares
iii) Places to visit

124
iv) Best hotel deals
Which of the above mentioned acts might have left a digital footprint?

a) i and ii
b) i, ii and iii
c) i, ii and iv
d) all of these

8. Naveen 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.

i) This is an example of __________ .


a. Online Fraud
b. Identity Theft
c. Phishing
d. Plagarism

ii) Someone steals Naveen’s personal information to commit theft or fraud, it is called
____________
a. Online Fraud
b. Identity Theft
c. Phishing
d. Plagarism

iii) Naveen receiving an Unsolicited commercial emails is known as __________


a. Spam
b. Malware
c. Virus
d. worms

iv) Naveen’s Online personal account, personal website are the examples of?
a. Digital wallet
b. Digital property
c. Digital certificate
d. Digital signature

v) Sending mean texts, posting false information about a person online, or sharing embarrassing
photos or videos to harass, threaten or humiliate a target person, is called ____________
a. Eavesdropping
b. cyberbullying
c. Spamming
d. Phishing

125
9. Prathyush has to prepare a project on “Cyber Jaagrookta Diwas”.He decides to get
information from the Internet. He downloads three web pages (webpage1, webpage 2, webpage
3) containing information on the given topic.
1. He read a paragraph from webpage 1 and rephrased it in his own words. He
finally pasted the rephrased paragraph in his project. And he put a citation about the website he
visited and its web address also.
2. He downloaded three images of from webpage 2. He made a collage for his
project using these images.
3. He also downloaded an icon from web page 3 and pasted it on the front page of
his project report.

(i) Step1 is an act of……………


(a) Plagiarism
(b) copyright infringement
(c) Intellectual Property right
(d) None of the above

(ii) Step 2 is an act of _______.


(a) plagiarism
(b) copyright infringement
(c) Intellectual Property right
(d) Digital Footprints

(iii) Step 3 is an act of ________.


(a) Plagiarism
(b) Paraphrasing
(c) copyright infringement
(d) Intellectual Property right

(iv) ______is a small piece of data sent from a website and stored in a user’s web browser while
a user is browsing a website.
(a) Hyperlinks
(b) Web pages
(c) Browsers
(d) Cookies

(v) The process of getting web pages, images and files from a web server to local computer is
called
(a) FTP
(b) Uploading
(c) Downloading
(d) Remote access

126
ANSWERS

OBJECTIVE TYPE QUESTIONS(1 mark)


1. True
2. False
3. Plagiarism
4. Spam
5. Spam or spamming
6. Copyright law
7. Open source software
8.True
9. Encryption
10. Netiquettes

MULTIPLE CHOICE QUESTIONS

1. a 2. d 3. d 4. D 5. B 6. C 7. d 8. a 9. D 10. A 11.b 12.a 13.d 14.b 15.b 16.b 17.a


18.b 19.b 20.d 21.b 22.b 23.b 24.c 25.c 26.a 27.c 28.b 29.b 30.c 31.c 32.d 33.c
34.d 35.d 36.a 37.b

CASE STUDY BASED QUESTIONS


1. b 2. a 3. c 4. a 5. b 6. A 7. d
8. i) c ii) b iii) a iv) b v) b
9. i) d ii) a iii) c iv) d v) c

SHORT ANSWER QUESTIONS(2 marks)

1. List any two health hazards related to excessive use of Technology

The continuous use of devices like smartphones, computer desktop, laptops, head phones etc
cause a lot of health hazards if not addressed. These are:
A. Impact on bones and joints: wrong posture or long hours of sitting in an uncomfortable
position can cause muscle or bone injury.
B. Impact on hearing: using headphones or earphones for a prolonged time and on high
volume can cause hearing problems and in severe cases hearing impairments.
C. Impact on eyes: This is the most common form of health hazard as prolonged hours of
screen time can lead to extreme strain in the eyes.
D. Sleep problem: Bright light from computer devices block a hormone called melatonin which
helps us sleep. Thus we can experience sleep disorders leading to short sleep cycles.

2. Priyanka is using her internet connection to book a flight ticket. This is a classic example
of leaving a trail of web activities carried by her. What do we call this type of activity? What is the
risk involved by such kind of activity?

127
call this type of activity as Digital Footprints

Risk involved : It includes websites we visit emails we send, and any information we submit
online, etc., along with the computer’s IP address, location, and other device specific details.
Such data could be used for targeted advertisement or could also be misused or exploited.

3. What We do you mean by Identity theft? Explain with the help of an example.

Identity theft is the crime of obtaining the personal or financial information of another person for
the sole purpose of assuming that person's name or identity to make transactions or use it to
post inappropriate remarks , comments etc.
Example:
Alex likes to do his homework late at night. He uses the Internet a lot and also sends useful data
through email to many of his friends. One Day he forgot to sign out from his email
account. In the morning, his twin brother, Flex started using the computer. He used Flex’s email
account to send inappropriate messages to his contacts

4. What do you understand by Net Ettiquetes? Explain any two such ettiquetes.

Net Ettiquets refers to the proper manners and behaviour we need to exhibit while being online.
These include :
1. No copyright violation: we should not use copyrighted materials without the permission of the
creator or owner. We should give proper credit to owners/creators of open source content when
using them.
2. Avoid cyber bullying: Avoid any insulting, degradingor intimidating online behaviour like
repeated posting of rumours, giving threats online,posting the victim’s personal information, or
comments aimed to publicly ridicule a victim.

5. According to a survey, one of the major asian country generates approximately about 2
million tonnes of electronic waste per year. Only 1.5 % of the total e-waste gets recycled.
Suggest some methods to manage e-waste .

Buy environmentally friendly electronics


Donate used electronics to social programs
Reuse , refurbish electronics
Recycling e-waste

128
SAMPLE QUESTION
PAPERS
Index

129
Index
(SQP SET I)
KENDRIYA VIDYALAYA SANGATHAN, ERNAKULAM REGION
INFORMATICS PRACTICES (065)
SAMPLE QUESTION PAPER - Class XII
Max Marks: 70 Time: 3 hrs
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in Q35
against part c only.
8. All programming questions are to be answered using Python Language only.

SECTION A
1 Beauty Lines Fashion Inc. is a fashion company with design unit and market unit 135 m 1
away from each other. The company recently connected their LANs using Ethernet
cable to share the stock related information. But after joining their LANs, they are not
able to share the information due to loss of signal in between. Which device out of the
following should you suggest to be installed for a smooth communication?
i. Repeater
ii. Hub
iii. Bridge
iv. Switch
2 Which of the following is a type of cybercrime? 1
i. Stealing of money from a purse
ii. Hitting or beating someone
iii. Making damage to furniture in classroom
iv. Stealing of user name and password and misusing others Email
3 What is not an example of e-waste? 1
i. Unused Mobile
ii. Unused old Keyboard
iii. Unused old computers
iv. Empty cola cans
4 Find the output of the following SQL command: 1
select mid(‘Informatics Practices’, -9);
5 If a column “Mark” in student table contains the following data 1

MARK
22
130
NULL
21
23

Predict the output of the following command:

SELECT AVG (MARK) FROM student;


i. 22
ii. 16.5
iii. NULL
iv. 66
6 ‘F’ in FOSS stands for: 1
i. Force
ii. Free
iii. Fibre
iv. First
7 Which SQL statement is used to display all the data from product table in the 1
decreasing order of price?

i. SELECT * FROM PRODUCT;


ii. SELECT * FROM PRODUCT ORDER BY PRICE;
iii. SELECT * FROM PRODUCT ORDER BY PRICE DESC;
iv. SELECT * FROM PRODUCT ORDER BY DESC;
8 The number of rows in a relation in SQL is known as 1
i. cardinality
ii. degree
iii. tuple
iv. attribute
9 Which among the following is a DDL command in SQL? 1
i. SELECT
ii. INSERT
iii. ALTER
iv. UPDATE
10 To display last three rows of a series object ‘S’, you may write: 1
i. S.Head()
ii. S.Tail(3)
iii. S.Head(3)
iv. S.tail()
11 Which of the following statement will import matplotlib.pyplot library? 1
i. Import pyplot as pd
ii. import matplotlib as py
iii. import matplotlib.pyplot as plt
iv. All of these
12 Which of the following can be used to specify the data while creating a DataFrame? 1
i. Series
ii. List of Dictionaries
iii. Structured ndarray

131
iv. All of these
13 _____________protocol allows us to have voice call (telephone service) over the 1
Internet
14 Write the output of the following SQL command: 1
SELECT ROUND(199.2936, 1);
15 Removal of parts containing the valuable items in E waste management is? 1
i. Refurbishment and reuse
ii Dismantling
iii Recycling
iv None of these
16 ------------------is the trail of data we leave behind when we visit any website (or use 1
any online application or portal) to fill-in data or perform any transaction.
i. Offline phishing
ii. Offline footprint
iii. Digital footprint
iv. Digital phishing
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice as
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True
17 Assertion (A): - The Internet is a collection of interconnected computer networks 1
linked by transmission medium such as copper wires, fiber-optic cables, wireless
connections etc

Reasoning (R):- World wide web is a collection of interconnected documents


18 Assertion (A):- DataFrame has both a row and column index. 1

Reasoning (R): - A DataFrame is a two-dimensional labelled data structure like a


table of MySQL.
SECTION B

19 Distinguish between LAN and WAN. 2


OR
Explain the function of the following network devices:
a. Modem
b. Firewall

20 Write SQL commands: - 2


a. To print the length of the string “Happy Holidays”
b. To print the string “Happy Holidays” in capital letters.

21 Differentiate between DDL and DML commands 2

22 Consider a given Series ,S1 with subject and marks where subject is index. 2
Subject Marks
ENG 76

132
HINDI 88
MATH 60
SCI 85
SST 81
Write a program in Python Pandas to create the series.
23 Write down different steps of E waste Disposal. 2
OR
Mention any four net etiquettes.
24 What will be the output of the following code: 2
>>>import pandas as pd
>>>A=pd.Series(data=[12,20,5,50])
>>>print(A>10)
25 Carefully observe the following code: 2
import pandas as pd
Sales1={'S1':5000,'S2':8000,'S3':12000,'S4': 18000}
Sales2={'A' :13000,'B':14000,'C':12000}
totSales={1:Sales1,2:Sales2} df=pd.DataFrame(totSales)
print(df)

Answer the following:


i. List the index of the DataFrame df
ii. List the column names of DataFrame df.
SECTION C
26 Consider the table SPORTS given below: 3
SCode SportName Noofplayers Coachname
S001 Cricket 21 Rahul Dravid
S002 Football 25 Roshan Lal
S003 Hockey 40 Sardar Singh
S004 Cricket 19 Chetan Sharma
S005 Archery 12 Limbaram
S006 Shooting 17 Deepika Kumari

a. Give output of following SQL command


Select Coachname from SPORTS Order By Coachname desc;

Write SQL commands to:


b. Write SQL command to display the total number of players in each sports.

133
c. Write SQL command to display sports name where the total number of players is
more than 25
27 Write a Python code to create a DataFrame with appropriate column headings from the 3
list given below:

[[101,'Ram',2500],[102,'Ann',5000],[103,'Sam' ,8000],[104,'Manu',4000]]
28 Consider the data frame and answer the questions 3

i)Write python code to display the profit rate of all quarters of Infosys company.
ii) Write python code to display the profit rate of Qtr3 of all companies
iii) Write the output of the python code
print(DF1.iat[1,1])

29 What is IT Act 2000? What is its importance? 3


OR
What do you understand by plagiarism? Why is it a punishable offence? Mention any
two ways to avoid plagiarism.
30 Identify the SQL functions to perform the following: 3
a. To print the name of the month of a specified date.
b. To print the date part of a specified date.
c. What will be the output of the following SQL Statements:
i. Select lower(“DATA for All”);
ii. Select instr("Wear formal uniform”, “form”);

OR

Differentiate between where and having clause with the help of suitable example
SECTION D
31 Consider the following table STUDENT. Write SQL commands for the following 5
statements.
Rollno Name Dob Class Gender Hobby Fees
1001 BHAVYA 2001-01-02 11 F Painting 100
1002 AARDRA 2002-10-21 1 F Drama 200
1003 AJITH 2004-12-11 80 M Cooking 150
1004 ARJUN 2001-02-22 10 M Cooking 250
1005 KAVYA 2005-10-12 8 F Sports 100
1006 ANAND 2000-02-01 1 M Drama 120
1007 ATHUL 2006-10-11 1
6 M Sports 150

134
1008 NEERAJA 2003-11-21 9 F Sports 100
1009 REHNA 2003-08-07 8 F Painting NULL
1010 VAISAKH 2001-12-11 10 M Cooking 120

a. To display details of all the students in the descending order of their Name.
b. To print the average fee for each hobby
c. To increase the fees of Cooking by 50 Rs
d. To store the fees of hobbies as 100 where fee is not available
e. To display the name of students who were born after ’01-01-2004’
OR
Explain the following functions with examples:
a. SUBSTRING()
b. POWER()
c. DAYNAME()
d. LTRIM()
e. LENGTH()

32 ABC company is working in 4 blocks- A, B, C and D. Following table shows the 5


distance between blocks and the number of computers in each of the blocks. The
company is planning to form a network of these blocks.

i. Suggest a cable layout of connections between the blocks.


ii. Suggest the most suitable place (i.e. block) to house the server of this organisation
with a suitable reason.

135
iii. Suggest the placement of the following devices with justification
(a) Repeater
(b) Hub/Switch
iv. The organization is planning to link its front office situated in the city in a hilly
region where cable connection is not feasible, suggest an economic way to connect
it with reasonably high speed?
v. The organisation is planning to link its sale counter situated in various parts of the
same city, which type of network out of LAN, MAN or WAN will be formed?
Justify your answer
33 Write Python code to plot a bar chart as shown below: 5

Also give suitable python statement to save this chart.


OR
Write a python program to plot a line chart based on the given data

Days=[1,2,3,4]
Wages in thousands=[40,42,38,44]
SECTION E
34 Consider the given table Result :- 1+1+2
Rollno Name Class DOB Gender City Marks
1 Nanda X 12-10-1998 F Delhi 56
2 Saurabh XI 24-12-1994 M Chennai 45
3 Sanal XII 15-08-2003 M Delhi 66
4 Rekha X 11-09-2004 F Mumbai 81
5 Neha XII 05-06-2006 F Chennai 77

136
i. Write SQL commands to :
ii. Display the minimum and maximum marks obtained by female students
iii. Display different Cities(without repetition) available in table
iv. Display the average mark obtained by students of each city
OR (Option for part iii only)
Display the class wise total of marks obtained by students

35 Consider the following DataFrame SPORTS


ID NAME GENDER
SD1 1 ANN F
SD2 2 RAM M
SD3 3 SITA F
SD4 4 RAJ F
Write commands to : 1+1+2

I. Add a new column ‘ITEM’ to the Dataframe


II. Add a new row with values (5, SAM, M):

III. Write python code to delete column gender


OR (Option for part iii only)
Write python statement to delete the row with index SD3.

137
(SET I)
KENDRIYA VIDYALAYA SANGATHAN, ERNAKULAM REGION
INFORMATICS PRACTICES (065) – MARKING SCHEME
SQP Answer Key - Class XII
Max Marks: 70 Time: 3 hrs
SECTION A
1 i. Repeater 1
1 mark for correct answer
2 iv. Stealing of user name and password and misusing others Email 1
1 mark for correct answer
3 iv. Empty cola cans 1
1 mark for correct answer
4 Practices 1
1 mark for correct answer
5 i. 22 1
1 mark for correct answer
6 ii. Free 1
1 mark for correct answer
7 iii. SELECT * FROM PRODUCT ORDER BY PRICE DESC; 1
1 mark for correct answer
8 i. cardinality 1
1 mark for correct answer
9 iii. ALTER 1
1 mark for correct answer
10 ii. S.Tail(3) 1
1 mark for correct answer
11 iii. import matplotlib.pyplot as plt 1
1 mark for correct answer
12 iv. All of these 1
1 mark for correct answer
13 VoIP 1
14 199.3 1
15 ii. Dismantling 1
1 mark for correct answer
16 iii. Digital footprint 1
1 mark for correct answer
17 ii. Both A and R are true and R is not the correct explanation for A 1
18 i. Both A and R are true and R is the correct explanation for A 1
SECTION B

19 LAN WAN 2
Local Area Network Wide Area Network
Limited to a single organization or Span countries and continents
building

138
Low cost to set up Cost of setting up is comparatively
high
Covers a distance of upto 1KM Distance > 25 KM
1 mark each for correct difference (two differences)
OR
a. Modem is a network device to convert analog signal to digital and vice versa
b. A firewall is a network security device that monitors traffic to or from a
network. It allows or blocks traffic based on a defined set of security rules.
(1 mark for each correct answer)
20 a. SELECT LENGTH(“Happy Holidays”); 2
b. SELECT UPPER(“Happy Holidays” );
OR
SELECT UCASE(“Happy Holidays” );

1 mark for each correct query.


21 DDL DML 2
Data definition Language Data Manipulation Language
DML commands are used DML command modifies the structure
to make modification of of the database schema
data inside the table
Eg: INSERT, DELETE, Eg: ALTER, CREATE, DROP
UPDATE
1 mark each for correct difference (two differences)

22 import pandas as pd 2
S1=pd.Series([76,88,60,85,81],index=['ENG','HINDI','MATH','SCI,’SST’])

1 mark for each correct python statement


23 Dismantling,segregation,refurbishment ,recycling ,disposal of dangerous material 2
½ mark for each
Or
i. No copyright violation
ii. Share the expertise with others on the internet
iii. Avoid cyber bullying
iv. Respect other’s privacy and diversity
½ mark for each net etiquette
24 2

½ mark for each correct output


25 i. The index labels of df will include S1,S2,S3,S4,A,B,C 2
ii. The column names of df will be: 1,2
1 mark for each correct answer

139
SECTION C
26 a. 3
Coachname
Sardar Singh
Roshan Lal
Rahul Dravid
Chetan Sharma
Deepika Kumari
Limbaram

b. SELECT SUM(Noofplayers) FROM SPORTS GROUP BY SportName;


c. SELECT SportName FROM SPORTS GROUP BY SportName HAVING
SUM(Noofplayers) > 25;
1 mark for each correct answer
27 import pandas as pd 3
data=[[101,'Ram',2500],[102,'Ann',5000],[103,'Sam', 8000], [104,'Manu',4000]]
df=pd.DataFrame(data,columns=['empno','Name', 'Salary'])

1 mark for each correct python statement


28 i) print(DF1.Infosys) or print(DF1['Infosys']) 3
ii ) print(DF1.loc['Qtr3', :])
iii) 67

1 mark for each correct statement


29 Legal recognition of e transaction 3
Parliament passed law in year 2000 called IT Act
Legally valid in india
1 mark for each correct answer
OR
Plagiarism is the act of using or stealing someone else’s intellectual work, ideas etc.
and passing it as your own work. In other words, plagiarism is a failure in giving
credit to its source.
Plagiarism is a fraud and violation of Intellectual Property Rights. Since IPR holds
a legal entity status, violating its owners right is a legally punishable offence.
Any two ways to avoid plagiarism:
 Be original
 Cite/acknowledge the source
1 mark for correct definition
1 mark for correct justification
½ mark each for any two ways to avoid plagiarism
30 a. 3
i. MONTHNAME(date) - 1 mark
ii. DATE(date) - 1 mark

140
b.
i. data for all -1/2 mark
ii. 6 -1/2 mark

OR

Where clause is used to put conditions on individual rows whereas having clause
is used to put conditions on groups. HAVING is used along with GROUP BY
clause (2 marks for correct answer)
1 mark for suitable example
SECTION D
31 5
a. SELECT * FROM STUDENT ORDER BY NAME DESC;
b. SELECT AVG(FEES), HOBBY FROM STUDENT GROUP BY HOBBY;
c. UPDATE STUDENT SET FEES=FEES+50 WHERE HOBBY=
’Cooking’;
d. UPDATE STUDENT SET FEES=100 WHERE FEES IS NULL;
e. SELECT NAME FROM STUDENT WHERE DOB > ‘2004-01-01’;
(1 mark for each correct query)
OR
a. SUBSTRING()- used to extract a string from a main string
Eg: SELECT SUBSTRING(“Python program”, 2,3) ;
will produce the output “yth”
b. POWER()- find the value of one number raised to another
Eg: SELECT POWER(2,3);
will produce the output 8
c. DAYNAME() – displays the name of day like “MONDAY, TUESDAY
etc”
Eg: SELECT DAYNAME(‘2022-09-29’); will give the output
THURSDAY
d. LTRIM() – displays the string with leading spaces removed
Eg: SELECT LTRIM(“ hello “);
will produce the output “hello “
e. LENGTH()- displays the number of characters in a string
Eg: SELECT LENGTH(“Python Program”);
will display 14
(1 mark for each correct answer)
32 5
i.
Block C

Block A Block B Block D

141
ii. Block C, since its having the highest number of computers among the
blocks. According to 80-20 rule, server should be placed in the block with
highest number of computers.
iii.
a. Block C to A, Block C to B, Block C to D – Since the distance
between the blocks is greater than 80m
b. Hub/Switch –should be placed in all the blocks, since the number of
computers in each block is greater than 1
iv. Radio waves
v. MAN , The network formed within a city is MAN
(1 mark for each correct answer)

33 import matplotlib.pyplot as plt import matplotlib.pyplot as plt 5


x=['Apple','Grape','Banana','Organge']
y=[90,70,40,80]
plt.bar(x,y)
plt.ylabel('prize')
plt.xlabel(Fruits’)
plt.show()

½ mark for each correct statement Python statement to save the chart:

plt.savefig("aa.jpg")
1 mark for the correct statement
OR
import matplotlib.pyplot as plt Days=[1,2,3,4]
wages=[40,42,38,44]
plt.plot(Days,wages)
plt.show()

1 mark for each correct statement


SECTION E
34 a. SELECT MIN(MARKS), MAX(MARKS) FROM RESULT WHERE 1+1+2
GENDER=’F’; ( 1 mark)
b. SELECT DISTINCT(CITY) FROM RESULT; ( 1 mark)
c. SELECT AVG(MARKS) FROM RESULT GROUP BY CITY;
OR
SELECT SUM(MARKS) FROM RESULT GROUP BY CLASS;( 1 mark)

35 i. SPORTS[‘ITEM’]=[‘Swimming’, ‘Dancing ’, ‘Cricket’, ‘Singing’]


ii. SPORTS.loc[‘SD5’]=[5, ‘RAM’, ‘M’]
1 mark for each
1+1+2
iii. del SPORTS[‘GENDER’]
OR
SPORTS.drop(index= ‘SD3’))
2 marks for correct Python statement

142
Index
KENDRIYA VIDYALAYA SANGATHAN ERNAKULAM REGION
INFORMATICSPRACTICES (065)
SAMPLE PAPER (2022 - 23) - Class XII – SET II
Max Marks: 70 Time: 3 hrs
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
6. Section C has 05 Short Answer type questions carrying 03 marks each.
7. Section D has 03 Long Answer type questions carrying 05 marks each.
8. Section E has 02 questions carrying 04 marks each. One internal choice is given in Q35
against part C only.
9. All programming questions are to be answered using Python Language only.

Part - A
1 Which of these is not a communication channel? 1
a) Satellite
b) Microwave
c) Radio wave
d) Wi-Fi

2 The command used to show legends is 1


a. display()
b. show()
c. legend()
d. legends()
e.
3 Write the output of the following SQL command. 1
select truncate(15.88,1);
a. 15.88
b.15.8
c.15.9
d. 16

4 Given a Pandas series called Marks, the command which will display the 1
last 2 rows is _______.

a. print(Marks.tail(2))
b. print(Marks.Tail(2))
c. print(Marks.tails(3)
d. print(Marks.tail())
143
5 If column “City” contains the data set (CHENNAI, MUMBAI, KOLKATA, CHENNAI, 1
KOLKATA), what will be the output after the execution of the given query?

SELECT COUNT(DISTINCT City) FROM Customer;


i. 4
ii. 5
iii. 3
iv. 2

6 Which of the following is not a valid chart type? 1


a. lineplot
b. bargraph
c. histogram
d. statistical
7 Which of the following crime(s) is/are covered under cybercrime? 1
i. Stealing brand new hard disk from a shop.
ii. Getting into unknown person’s social networking account and start
messaging on his behalf.
iii. Copying some important data from a computer without taking permission
from the owner of the data.
iv. Working on someone’s computer with his/her permission.

(a) only (ii) (b) (ii) and (iv) (c) (ii) and (iii) (d) (iii) and (iv)
8 The __________ attribute of a dataframe object returns the row labels of a 1
dataframe.
a. index
b. columns
c. rows
d. column
9 Which of the following is not a network device : 1
a. Repeater
b. hub
c. TCP
d. switch
10 Website stores the browsing activity through _____________________ 1
a. web page
b. Cookies
c. passwords
d. server
11 Which of the following is not an aggregate function ? 1
a. Avg()
b. Trim()
c. Min()
d. Sum()

12 A _______ is a type of intellectual property consisting of a symbol, word, or words 1


legally registered or established by use as representing a company or product.

144
(a) Trademark
(b) Patent
(c) Copyright holder
(d) Plagiarism
13 A Dataframe object is a collection of ______________ type of data 1
a. Homogenous
b. Heterogenous
c. Hybrid
d.None of the above
14 The practice of taking confidential information from you through an original 1
looking site and URL is known as
a. hacking
b. fishing
c. phishing
d. Eavesdropping
15 ‘F’ in FOSS stands for: 1
(a) Free
(b) Forever
(c) Fire
(d) Freezing
16 Unsolicited commercial email is known as _______________ . 1
a. Junk mail
b. Spam
c. Trash
d. Chats
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct choice
as
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True

17 ASSERTION(A): The practice of taking someone else’s work or ideas and 1


passing them off as one’s own
REASONING( R ): Using graphs, charts, figures, or images without
reference of source

18 ASSERTION(A): The shape attribute returns the number of rows and 1


number of columns available in data frame.
REASONING( R ): The shape attribute return the values in form of list.

Part - B
Write an overview of Indian IT Act 2
19 OR
What can be done to reduce the risk of identity theft? Write any two ways.

145
With SQL, how can you return the number of rows not null value in the Project field 2
of Students table
(a) SELECT COUNT(Project) FROM STUDENTS;
20 (b) SELECT COLUMNS(Project) FROM STUDENTS;
(c) SELECT COLUMNS(*) FROM STUDENTS;
(d) SELECT COUNT(*) FROM STUDENTS:
Write a short explanation of your answer query.

What is the difference between the group by and order by clause when
21 2
used along with the select statement? Explain with an example.
Write a program in Python Pandas to create a series which stores marks of
5 subjects of a student in class 10B of your school.
22 2
Assume that student is studying class X and have 75,78,82,82,86 marks
Give any 2 solutions to manage the E-Waste in the country.
23 OR 2
List any two health hazards related to excessive use of technology
What will be the output of the following code:

>>>import pandas as pd
>>>rollno=[1,2,3,4,5,6]
24 2
>>>marks=[23,86,74,11,98,75]
>>>s=pd.Series(marks,index =rollno)
>>>print(s[s>75])

Carefully observe the following code:


import pandas as pd
data = [{'a': 10, 'b': 20},{'a': 6, 'b': 32, 'c': 22}]
df1 = pd.DataFrame(data)
25 print(df1) 2
Answer the following:
i. List the index of the DataFrame df1
ii. List the column names of DataFrame df1.

Section C

Ms Malini is working in a school and stores the details of all students in a table
SCHOOLDATA.
TABLE : SCHOOLDATA

26 3

146
Find the ouput :
i. SELECT LENGTH(NAME) FROM SCHOOLDATA WHERE HOUSE=’Red’;
ii. SELECT LEFT (Gender, 1), Name FROM SCHOOLDATA WHERE YEAR
(Dob) = 2005;
iii. SELECT MID(UPPER(NAME),5,4) FROM SCHOOLDATA WHERE
GENDER = ’Male’;

Write a Python code to create a DataFrame with appropriate column headings from
the list given below:
27 [[‘Nidhi’,’Business Studies’,95],[‘Gurjeet’,’Informatics Practices’,97], 3
[‘Pahul’,’Accountancy’,88], [‘Divya’,’English’,72]]

Consider the given DataFrame shop


APPLIANCE_NAME DISCOUNT PRICE
0 REFRIGERATOR 15 19800
1 SMART PHONE 20 22300
2 TELEVISION 22 12900
3 AIR CONDITIONER 15 23500
28 4 WASHING MACHINE 18 18900 3
5 WASHING MACHINE 15 20110
Write the commands for the following:
i. Add a column called Special_Quantity with the following data:
[62,26,12,32,48,52,35].
ii. Add a new Electronics item named ’TELEVISION’,12 having price 35600.
iii. Remove the column Special_Quantity.

Sutapa received an email from her bank stating that there is a problem with
her account. The email provides instructions and a link, by clicking on
which she can logon to her account and fix the problem.
i. What is this happening to Sutapa?
29 ii. What immediate action should she take to handle it? 3
iii. Is there any law in India to handle such issues? Discuss briefly.
OR
What do you understand by hacking? Why is it a punishable offence? Mention any
two ways to avoid hacking.
Based on table SCHOOL given here, write suitable SQL queries for the following:
CODE TEACHERNAME SUBJECT Category DOJ PDS EXP
1001 RAVI SHANKAR ENGLISH PGT 12/03/2000 24 10
1009 PRIYA RAI PHYSICS TGT 03/09/1998 26 12
1203 LISA ANAND ENGLISH TGT 09/04/2000 27 5
30 1045 YASHRAJ MATHS PGT 24/08/2000 24 15 3
1123 GANAN PHYSICS TGT 16/07/1999 28 3
1167 HARISH B CHEMIST PGT 19/10/1999 27 5
RY
1215 UMESH PHYSICS TGT 11/05/1998 22 16

i. Display subject wise highest experience.


147
ii. Display category wise lowest experience.
iii. Display total number of PGT and TGT teachers
OR
Briefly explain the difference between count() and count(*) with the help of
an example.
Section D
Write the names of SQL functions which will perform the following
operations:
i) To display the current date
ii) To convert the string in capital letters ‘Kendriya’
iii) To remove spaces from the end of string “Good Morning”
iv) To display the month from the current date
v) To compute the power of a number n1 raised to the power n2
OR
Consider the following tables STATIONERY and answer the
questions:
Table: STATIONERY

31 S_ID Stationery Name Company Price 5


DP01 Dot Pen ABC 10.50
PL02 Pencil XYZ 6.00
ER05 Eraser XYZ 7.50
PL01 Pencil CAM 5.75
GP02 Gel Pen ABC 15.00
Write SQL commands using SQL functions to perform the following operations:
i) Display the stationary name and price after rounding off to zero decimal
places.
ii) Display the occurrence of ‘en’ in stationary name.
iii) Display the first four characters of the stationary name.
iv) Display the names of company after converting to lower case.
v) Display the length of stationary names
“Learn Together” is an educational NGO. It is setting up its new campus at Jaipur
for its web based activities. The campus has 4 compounds as shown in the
diagram below:

Resource Main
32 Compound Compound 5

Training Finance
Compound Compound

148
Center to center distances between various Compounds as per architectural
drawings (in Metre) is as follows :
Main Compound to Resource Compound 110 m
Main Compound to Training Compound 115 m
Main Compound to Finance Compound 35 m
Resource Compound to Training Compound 25 m
Resource Compound to Finance Compound 135 m
Training Compound to Finance Compound 100 m

Expected Number of Computers in each Compound is as follows:


Main Compound 5
Resource Compound 15
Training Compound 150
Accounts Compound 20

1. Suggest a cable layout of connections between the compounds.


2. Suggest the most suitable topology of the connection between the wings.
3. Suggest the most suitable place (i.e. compound) to house the server for this
NGO. Also, provide a suitable reason for your suggestion.
4. Suggest the placement of the following devices with Justification :
(i) Repeater
(ii) Hub/Switch
5. The NGO is planning to connect its International office situated in Mumbai,
which out of the following wired communication link, you will suggest for a
very high speed connectivity?
(i) Telephone Analog Line
(ii) Optical Fiber
(iii) Ethernet Cable

Consider the following graph .Write the code to plot it.

33

Also give suitable python statement to save this chart.


OR

149
Write a python program to plot a line chart based on the given data to depict the
changing medal tally between four Houses in school.

House=['Varun', 'Prithvi', 'Agni', 'Trishul']


medal=[50,70,90,110]

SECTION E
Mukund, a database administrator has designed a database for a clothing sports
club. Help him by writing answers of the following questions based on the given
table:

Consider the table SPORTS and give the output for the following queries:
StudentNo Class Name Game Grade
10 7 Sammer Cricket B
11 8 Sujit Tennis A
12 7 Kamal Swimming B 1+1+2
34
13 7 Venna Tennis C
14 9 Archana Basketball A
15 10 Arpit Cricket A
i. Write a query to display Game in lower case.
ii. Write a query to display the lowest class of the sports club.
iii. Write a query to count total number of Games with grade A.
OR (Option for part iii only)
Write a query to count class wise total number of games played

Mr. Ravi, a data analyst has designed the DataFrame df that contains data about
Car Sales with ‘T1’, ‘T2’, ‘T3’, ‘T4’, ‘T5’ as indexes shown below. Answer the
following questions:

Col1 Col2 Col3 Res


T1 62.893165 100.0 60.00 True
T2 94.734483 100.0 59.22 True
T3 49.090140 100.0 46.04 False 1+1+2
35
T4 38.487265 85.4 58.60 False
A. Predict the output of the following python statement:
i. df.shape
ii. df[1:3]
B. Write Python statement to display the data of Col3 column of indexes T2 to T4.
OR (Option for part B only)
Write Python statement to compute and display the difference of data of Col2
column and Col3 column of the above given Data Frame.

150
KENDRIYA VIDYALAYA SANGATHAN ERNAKULAM REGION
CLASS XII - INFORMATICS PRACTICES (065)
SAMPLE PAPER – II MARKING SCHEME
Max Marks: 70 Time: 3 hrs

Q PART – A Marks
No
1. d) Wi-Fi 1
2. c. legend() 1
3. b. 15.8 1
4. a. print(Marks.tail(2)) 1
5. iii. 3 1
6. d. statistical 1
7. (c) (ii) and (iii) 1
8. c)index 1
9. c)TCP 1
10. b)Cookies 1
11. b) Trim() 1
12 a) Trademark 1
13. b)Heterogenous 1
14. c)Phishing 1
15. a) Free 1
16. b) Spam 1
17. i. Both A and R are true and R is the correct explanation for A 1
18. iii. A is True but R is False 1
Section-B
19. The Information Technology Act of 2000 came into force on October 17, 2
2000. This act is imposed upon the whole of India. Its provisions apply to
any offense committed inside or outside India's geographic boundaries
and irrespective of nationality.
The act covers offenses involving computers, computer systems, or
computer networks in India. It also makes acts like hacking, data theft,
spreading of computer viruses, identity theft, defamation (sending offensive
messages), pornography, child pornography, and cyber terrorism criminal
offenses.

151
Or
Always use strong passwords at least eight characters long that have
numbers and special characters (like: $, %, &), and that do not contain a word
found in the dictionary. Change your passwords frequently and never share
them.
Avoid using software downloaded from unknown websites or peer-to-peer file
sharing services. Avoid software that claims to be game, a screensaver,
collect information for "marketing purposes" or promises to "accelerate your
internet connections." These are actuallyprograms that can include spyware.
20. a. SELECT COUNT(Project) FROM STUDENTS; 2
count ignores null values while counting the values in its argument
column
21. 2
Group By Order By
It is used to divide the table into It sorts the result set either in
logical groups ascending or descending order
Logical grouping is done based result-set is sorted based on the
on the similarity among the column's attribute values, either
row's attribute values. ascending or descending order.
Select brand, count(*) Select *
from appliances from appliances
group by Brand order by discount asc;

22. 2

23. i. Give Your Electronic Waste to a Certified E-Waste Recycler 2


ii. Donating Your Outdated Technology
iii. Give Back to Your Electronic Companies and Drop Off Point

Or
The continuous use of devices like smartphones, computer desktop,
laptops, head phones etc cause a lot of health hazards if not addressed.
These are:
i. Impact on bones and joints: wrong posture or long hours of sitting in
an uncomfortable position can cause muscle or bone injury

152
ii. Impact on hearing: using headphones or earphones for a prolonged
time and on high volume can cause hearing problems and in
severe cases hearing impairments.
iii. Impact on eyes: This is the most common form of health hazard as
prolonged hours of screen time can lead to extreme strain in the
eyes.
iv. Sleep problem: Bright light from computer devices block a hormone
called melatonin which helps us sleep. Thus, we can experience
sleep disorders leading to short sleep cycles

Write any Two


24. 2 86 2
5 98
dtype: int64
25. 2

i. 0
1
ii. a b c
Section - C
26. 3

i) LENGTH(NAME)
12
10
12
ii) LEFT (Gender, 1) Name
F Swapnil Pant
M Rahil Arora
iii) MID(UPPER(NAME),5,4)
A DA
SHA
N RA
A SI

27. import pandas as pd 3


data=[['Nidhi','Business Studies',95],['Gurjeet','Informatics Practices',97],
['Pahul','Accountancy',88],['Divya','English',72]]
df=pd.DataFrame(data,columns=['name','subject','marks'])
print (df)
153
28 i. stock['Special_quantity']=[ [62,26,12,32,48,52,35]] 3
ii. stock.loc['6']=[ ’TELEVISION’,12, 35600]
iii. stock=stock.drop('Special_quantity',axis=1)
29 3
Hacking is the act of compromising digital devices and networks
through unauthorized access to an account or computer system.
Hacking is not always a malicious act, but it is most commonly associated
with illegal activity and data theft by cyber criminals.
Ways to avoid Hacking:
Use two-factor authentication.
Make sure you're on an official website when entering passwords.
30 3
i. select max(exp) from school group by subject;
ii. select min(exp) from school group by category;
iii. select category,count(category) from school group by category;
1 mark for each correct query
OR
Count(* ) Count( )
Is used to count the Is used to count
number of rows in the values
query present in any
column excluding
NULL values
Consider the table SPORTS

S_Id Name
SW01 NULL
SB02 Football
SB03 Hockey
SW04 Swimming

Select count(*) from sports;


Output : 4
Select count(Name) from sports;
Output : 3
Here the second output is 3 because Name column contain a NULL value
1 mark for correct significance

154
2 marks for correct example

SECTION D
31 i. select CURDATE(); 5
ii. select UCASE(‘Kendriya’)
iii. select rtrim( “Good Morning “);
iv. select month(curdate());
v. select power(n1,n2);
OR
i. select stationaryname, ROUND(price) from stationary;
ii. select INSTR(stationaryname, ’en’) from stationary;
iii. select LEFT(stationaryname, 4) from stationary;
iv. select LCASE(company ) from stationary;
select LEN(stationaryname) from stationary;
32 5

e1.
e2. Bus topology
e3. Training compound.
e4. i. Repeater to be connected between Resource compound and Main
compound as thedistance is more than 70m.
ii. Hub/Switch to be connected in every compound to network computers.
e5. ii. Optical Fiber
33 import matplotlib.pyplot as plt 5
x = [1, 2, 3, 4]
h = [20, 50, 30, 40]
plt.xlabel('Subjects') plt.ylabel('Marks') plt.bar(x, h, width=0.5)
plt.show()
plt.savefig(“bar.png”)
or
155
import matplotlib.pyplot as plt
house=['Varun', 'Prithvi', 'Agni', 'Trishul']
medal=[50,70,90,110]
plt.plot(house,medal)
plt.show()
SECTION E
34 i. Select lower(Game) from sports;
ii. Select min(Class) from sports ;
1 mark for each correct query
iii. Select count(class) from sports group by game having grade=’A’ 1+1+2
OR
Select Class ,count(Game) from sports group by Game;
2 marks for correct query
35 A.
Output:

i. (4,4)
ii.
Col1 Col2 Col3 Res
T2 94.734483 100.0 59.22 True
1+1+2
T3 49.090140 100.0 46.04 False
1 mark for each correct query

B. Python statement:
print(df.loc['T2': 'T4', 'Col3'])
OR
print(df.Col2 - df.Col3)
2 marks for correct Python statement

156
Index
SET III

KENDRIYA VIDYALAYA SANGATHAN, ERNAKULAM REGION


INFORMATICS PRACTICES (065)
SAMPLE QUESTION PAPER - (2022 - 23)
Class XII
Max Marks: 70 Time: 3 hrs

General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in Q35
against part C only.
8. All programming questions are to be answered using Python Language only.
PART A
1 Given a Pandas series called S, the command which will display the last 4 rows is _______. 1
a. print(S.tail(4))
b. print(s.Tail())
c. print(s.tails(4))
d. print(s.tail(4))
2 __________ are messages that a web server transmits to a web browser so that the web 1
server can keep track of the user’s activity on a specific website.
a. text
b. cookies
c. email
d. chat
3 The trim()function in MySql is an example of . 1
a. Math function
b. Text function
c. Date Function
d. Aggregate Function
4 The command can be used to insert a new row in a table in SQL. 1
a. add()
b. append
c. insert into
d. alter table.
5 State whether True or False : 1
i. Copying and pasting data from internet or other digital resources is ethical.
ii. E-waste is very hazardous if not handled carefully.
6 Rohan wants to print the row labels of the dataframe. He should use the _____________ 1
attribute of a dataframe.

157
a. column
b. columns
c. index
d. rowname
7 Write the output of the following SQL command. 1
select pow(2,–2);
a. -4
b. 4
c. 0.25
d. -0.25
8 What is e-waste? 1
(a) electronic waste
(b) environmental waste
(c) earth waste
(d) energy waste
9 What will be the output of the following code? 1
mysql>> lcase ('INFORMATICS PRACTICES CLASS 12TH');

10 Which of these is not an example of unguided media? 1


(i) Optical Fibre Cable (ii) Radio wave (iii) Bluetooth (iv) Satellite

11 Stealing someone’s intellectual work and representing it as your own is known as _____. 1
a. Phishing
b. Spamming
c. plagiarism
d. hacking

12 Which of the following is not the correct aggregate functions in SQL. 1


(a) AVERAGE() (b) MAX() (c) COUNT() (d) TOTAL()

13 A URL can specify the IP address of the Web ____________ that houses a Web page? 1
a) server
b) client
c) e-mail recipient
d) None

14 ………………. are the records and traces that are left behind while internet is used. 1
a) Digital data
b) Digital Footprint
c) Data Protection
d) Plagiarism
15 To mention conditions along with group by function …………………clause is used. 1
a)Where b)having c)distinct d)select
16 Jhilmalini has stolen a credit card. She used that credit card to purchase a laptop. What 1
type of offence has she committed?
a. online fraud
b. cyber bullying
158
c. cyber stalking
d. All of the above.

Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct
choice as
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
iv. A is false but R is True
17 Assertion (A) : import matplotliblib.pyplot as plt is used to import pyplot .
Reason (R) :It is python library so it is imported for using its function.

18 Assertion (A):- Series store data row wise.


Reasoning (R): - A Series is a one-dimensional labelled data structure.

SECTION B
19 Consider a given Series , T1: 2
SUB1 45
SUB2 65
SUB3 24
SUB4 89
Write a program in Python Pandas to create the series.
OR
Define Series. Write a python statement to create an empty statement.
20 Rohit writes the following commands with respect to a table student having fields, Sno, 2
name, Age, fee.
Command1 : Select count(*) from student;
Command2: Select count(name) from employee;
he gets the output as 6 for the first command but gets an output 5 for the second command.
Explain the output with justification.
21 Consider the following Series object, C_amt 2
Mouse 135
Keyboard 260
Pen drive 80
CD 155
i. Write the command which will display the name of the items having amount <100.
ii. Write the command to name the series as comp_items.

22 Consider the following DataFrame, Student 2

Rollno Name Class Section Marks Stream


S1 1 Sheetal XI A 87 Science
S2 2 Preet XI B 89 Arts
S3 3 Kartik XI A 92 Science
S4 4 Laksh XI A 94 Commerce

Write commands to :
159
i. Add a new column ‘Percentage’ to the Data frame.
ii. Add a new row with values ( 5 , Rohit ,XI, A ,98,Science)

23 Expand the following terms related to Computer Networks: 2


a. HTTP
b. POP3
c. FTP
d.VoIP
OR
Differentiate between static and dynamic web pages.
24 Consider the following SQL string: “Computer” 2
Write commands to display:
a. “mputer”
b. “ut”
OR
Considering the same string “Computer”
Write SQL commands to display:
a. The position of the substring ‘ter’ in the string “Computer”.
b.The first 5 letters of the string.
25 List any two health problems related to excessive use of Technology. 2
SECTION C
26 Cconsider two objects s and t. s is a list whereas t is a Series. Both have values 20, 40, 3
90, 110.
What will be the output of the following two statements considering that the above objects
have been created already

a. print (s*2) b. print(t*2)

Justify your answer.


27 Consider the Table “Infant” shown below. 3
Table: Infant

NOTE: Discount column stores discount %.


Write SQLcommands to:
a. To displays the number of items that have more than 10% as discount.
b. To display the highest unit price of items.
c. To display the names of items that has ‘Baby’ anywhere in their item names.

28 Write a Python code to create a DataFrame with appropriate column headings from the list 3
160
given below:

[[21101,'MANJUSH',58],[21102,'AKSHAY',60],[21103,'ANN' ,76],
[21104,'NITHYA',48]]
29 What are the different ways in which authentication of a person can be performed? 3
OR
Describe measures to recycle your e-waste.
30 Predict the output of the following queries: 3
I) SELECT INSTR (‘Very good’, 'good');
II) SELECT MID('Quadratically',5,6);
III) SELECT RIGHT (‘Command', 3);
OR
Explain the following SQL functions using suitable examples.
a) INSTR()
b) MID()
c) RIGHT()
SECTION D
31 Consider the following graph. Write the code to plot it. 5

OR
Draw the following bar graph representing the uses of programming language.

32 A company AST Enterprises has 4 wings of buildings as shown in the diagram : 5


Center to center distances between various Buildings:
T3 to T1 - 50m
T1 to T2 - 60m
T2 to T4 - 25m
T4 to T3 - 170m
T3 to T2 - 125m

161
T1 to T4 - 90m

Number of computers in each of the wing:


T1 - 140
T2 - 15
T3 - 15
T4 - 25

T1 T2

T3 T4

Computers in each wing are networked but wings are not networked The company has
now decided to connect the wings also.
i. Suggest a most suitable cable layout for the above connections.
ii. Suggest the most appropriate topology of the connection between the wings.
iii. The company wants internet accessibility in all the wings. Suggest a suitable
technology.
iv. Suggest the placement of the following devices with justification if the company
wants minimized network traffic
a) Repeater b)Hub / switch
v. The company is planning to link its head office situated in Pune with the offices
in hilly areas. Suggest a way to connect it economically.
33 Write the SQL functions which will perform the following operations: 5
i) To display the current date .
ii) To display the substring “earn” from the whole string ‘LearningIsFun’.
iii) To round the number 76.384 up to 2 place after decimal point.
iv) To find the position of first occurrence of ‘R’ in string 'INFORMATION FORM'
v) To find out the result of 93 .
OR
Consider a table Order with the following data:

Write SQL queries using SQL functions to perform the following operations:
i) To count the number of orders booked by Salespersons with names starting with ‘R’.
ii) Display the position of occurrence of the string “an” in SalesPerson names.
iii) Display the four characters from SalesPerson name starting from second character.
162
iv) To find the average of order amount.
v) Display the month name for the Order date.
SECTION E
34 A relation Vehicles is given below: 1+1+2

Write SQL commands to:


a. Count the type of vehicles manufactured by each company.
b. Display the total price of all the types of vehicles.
c. Display the average price of each type of vehicle having quantity more than 20.
OR (Option for part iii only)
Write a query to display type and price * quantity with title TOTAL PRICE company wise

35 A dataframe fdf stores data about passengers, Flights and Years as given below. 2+1+1

S_NO Year Months MalePassengers FemalePassengers


1 2009 January 90 30
2 2009 February 100 18
3 2009 March 98 22
4 2009 April 110 30

1) Write python code to create the dataframe.

Perform the following operations on the DataFrame :


2) Add both the male and female passengers and assign to column “Total_ passengers”
3) Display the maximum passengers in male passengers and maximum passengers in
female passengers of the Data Frame.
OR (Option for part iii only)
Predict the output of the following python statement:
fdf.loc[:,’year’:’MalePassengers’]

163
SET-III
KENDRIYA VIDYALAYA SANGATHAN, ERNAKULAM REGION
INFORMATICS PRACTICES (065) SAMPLE QUESTION PAPER (2022 - 23)
Class XII - Marking Scheme

Max. Marks: 70 Time: 3 hours


QNo.. Section A Total
1 print(S.tail(4)) 1
1 mark for the correct usage of tail()
2 Cookies 1
1 mark for the correct answer
3 Text function 1
1 mark for the correct answer
4 Insert into 1
1 mark for the correct answer
5 i. False 1
ii. True
½ mark for each correct answer
6 Index 1
1 mark for the correct answer
7 0.25 1
1 mark for the correct answer
8 electronic waste 1
1 mark for the correct answer
9 informatics practices class 12th 1
1 mark for the correct answer
10 Optical Fibre Cable 1
1 mark for the correct answer
11 Plagiarism 1
1 mark for the correct answer
12 TOTAL() 1
1 mark for the correct answer
13 server 1
1 mark for the correct answer
14 digital Footprint 1
1 mark for the correct answer

15 Having 1
1 mark for the correct answer

16 She has committed a fraud 1


1 mark for the correct answer
17 i.Both A and R are true and R is the correct explanation for A 1

164
18 iv. A is false but R is True 1
Section B
19 import pandas as pd 2
T1=pd.Series([45,65,24,89],index=['SUB1','SUB2','SUB3','SUB4'])
½ mark for import statement
½ mark for usage of Series ()
½ mark for stating index as a list
½ mark for creating object T1
20 This is because the column name contains a NULL value and the aggregate 2
functions do not take into account NULL values. Thus Command1 returns the
total number of records in the table whereas Command2 returns the total
number of non NULL values in the column name.
21 i. print(C_amt [C_amt <100]) 2
ii. C_amt.name=' comp_items '
1 mark each for correct answer of part (i) , (ii)
22 i. classframe[‘Percentage’]=[87,89,92,94] 2
ii. classframe.loc[‘t5’]=[5,’ROHIT’, ‘XI’, ‘A’, 98, ‘Science’]
1 mark for each correct answer
23 a. HTTP: Hyper Text Transfer Protocol 2
b. POP: Point to Point Protocol
c. FTP: File Transfer Protocol
d. VoIP: Voice over Internet Protocol
½ marks for each correct full form

Or

24 I. 2
1. a. select substr("Computer", 3);
1. b. select substr("Computer",5,2);
OR
2. a. select instr ('Computer' , 'ter');
2. b. select left ('Computer',5);
1 mark for each correct /similar answer ( of part (a) , (b))
25 The continuous use of devices like smartphones, computer desktop, laptops, 2
head phones etc cause a lot of health hazards if not addressed. These are:
i. Impact on bones and joints: wrong posture or long hours of sitting in an
165
uncomfortable position can cause muscle or bone injury.
ii. Impact on hearing: using headphones or earphones for a prolonged time
and on high volume can cause hearing problems and in severe cases
hearing impairments.
iii. Impact on eyes: This is the most common form of health hazard as
prolonged hours of screen time can lead to extreme strain in the eyes.
iv. Sleep problem: Bright light from computer devices block a hormone called
melatonin which helps us sleep. Thus we can experience sleep
disorders leading to short sleep cycles.
2 marks for any two correct points
SECTION C
26 a. will give the output as: 3
[20,40,90,110,20,40,90,110]

b. will give the output as


0 40
1 80
2 180
3 220

Justification: In the first statement s represents a list so when a list is


multiplied by a number, it is replicated that many number of times.
The second t represents a series. When a series is multiplied by a value, then
each element of the series is multiplied by that number.

1 mark for output of list multiplication


1 mark for output of Series multiplication 1 mark for the justification
27 a. SELECT COUNT(Item) FROM Infant WHERE Discount > 10; 3
b. SELECT MAX(UnitPrice) FROM Infant;
c. SELECT Item FROM Infant WHERE Item LIKE ‘%Baby%’;
1 mark for each correct query
28 import pandas as pd 3
data=[[21101,'MANJUSH',58],[ 21102,'AKSHAY',60],[ 21103,'ANN' ,76],
[21104,'NITHYA',48]]
df=pd.DataFrame(data,columns=['Rno','Name', 'Marks'])
1 mark for each correct python statement
29 Diff. methods of user identification are: 3
a. Password
b. Token
c. Biometrics
d. OTP
OR
Following measures can be adopted to recycle the e-waste safelya. Use a
certified e-waste recycler.
166
b. Visit civic institutions.
c. Explore retail options.
d. Donate your electronics.

3 marks for correct measures and its explaination.


30 IV) 6 3
V) Ratica
VI) and
OR
1 mark for each correct explanation of functions.
Section D
31 import numpy as np 5
import matplotlib.pyplot as plt
marks=[8,9,18,16,29,28,27,26,30]
plt.hist(marks,bins=[0,10,20,30],edgecolor="red")
plt.savefig("hist.png")
plt.show()
1 mark for the import statement
1 mark for appropriate usage of hist() 1 mark for show()
OR
import matplotlib.pyplot as plt;
import numpy as np
objects = ('Python', 'C++', 'Java', 'Perl', 'Scala', 'Lisp')
y_pos = np.arange(len(objects))
performance = [10,8,6,4,2,1]
plt.bar(y_pos, performance, align='center') plt.xticks(y_pos, objects)
plt.ylabel('Usage') plt.title('Programming language usage')
plt.show()
1 mark for the import statement
1 mark for appropriate usage of bar()
1 mark for show().
32 i) Most suitable layout according to distance is : 5

1 mark for an appropriate cable layout


ii) Star Topology
1 mark for correct topology

167
iii) Broadband.
1 mark for suggesting suitable technology
iv). a. Not required. Repeaters may be skipped as per above layout (because
distance is less than 100 m)
b. In every wing

½ mark for placement of repeater ½ mark for placement of hub


/ switch
v) Radio Waves
1 mark for the appropriate connectivity mode between HQ and other offices

33 (i) SELECT SYSDATE(); 5


(ii) SELECT MID('LearningIsFun',2,4);
(iii) SELECT ROUND(76.384,2);
(iv) SELECT INSTR('INFORMATION FORM','RM');
(v) SELECT POW(9,3);
1 mark for each correct answer
OR
(i) SELECT COUNT (*) FROM Order WHERE SalesPerson LIKE “R%”;
(ii) Select instr(Salesperson, “an”) from order;
(iii) Select mid(Salesperson,2,4) from order;
(iv) Select avg(OrderAmount) from order.
(v) Select dayname(OrderDate) from order;
1 mark for each correct answer
SECTION E
34 a) select Company, count(distinct Type) from Vehicle group by Company; 1+1+2
b) Select Type, sum(Price* Qty) from Vehicle group by Type;
c) select Type, avg(Price) from Vehicle group by Type having
Qty>20;
OR (Option for part iii only)
Select type,price*quantity as ‘TOTAL PRICE’ from vehicles
group by company.

35 1) import pandas as pd d1={'S_NO':[1,2,3,4], 1+1+2


'Year':[2009,2009,2009,2009,2009],
'Month':[‘January’,‘February’,’March’,’April’],
‘MalePassengers’ ':[90,100,98,110],
‘FemalePassengers ':[30,18,22,30]
}
fdf=pd.DataFrame(d1)
print(df)

168
2) df[' Total_ passengers’]=df['MalePassengers ']+ df[' FemalePassengers ']
print(df)

3) print("Maximum Passengers are : " , max(df[' MalePassengers ']), max(df['


FemalePassengers ']))
1 mark for import statement
2 marks for creating the dataframe
1 mark for creating column Total_ passengers’ to hold the sum of male and
female passengers.
1 mark for displaying maximum in male passengers & Female passengers.
OR (Option for part iii only)
ii fdf.loc[:,’year’:’MalePassengers’]
S_NO Year Months MalePassengers
1 2009 January 90
2 2009 February 100
3 2009 March 98
4 2009 April 110

169
Index
SET - IV
CBSE SAMPLE QUESTION PAPER CLASS XII
INFORMATICS PRACTICES (065)

TIME: 3 HOURS M.M.70


General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A have 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is
given in Q35 against part c only.
8. All programming questions are to be answered using Python Language only.

PART A
1. Television cable network is an example of: 1
i. LAN
ii. WAN
iii. MAN
iv. Internet
2. Which of the following is not a type of cyber crime? 1
i. Data theft
ii. Installing antivirus for protection
iii. Forgery
iv. Cyber bullying
3. What is an example of e-waste? 1
i. A ripened mango
ii. Unused old shoes
iii. Unused old computers
iv. Empty cola cans

170
4. Which type of values will not be considered by SQL while executing the 1
following statement?

SELECT COUNT(column name) FROM inventory;

i. Numeric value
ii. text value
iii. Null value
iv. Date value
5. If column “Fees” contains the data set (5000,8000,7500,5000,8000), 1
what will be the output after the execution of the given query?
SELECT SUM (DISTINCT Fees) FROM student;

i. 20500
ii. 10000
iii. 20000
iv. 33500

6. ‘O’ in FOSS stands for: 1


i. Outsource
ii. Open
iii. Original
iv. Outstanding

7. Which SQL statement do we use to find out the total number of records 1
present in the table ORDERS?

i. SELECT * FROM ORDERS;


ii. SELECT COUNT (*) FROM ORDERS;
iii. SELECT FIND (*) FROM ORDERS;
iv. SELECT SUM () FROM ORDERS;

8. Which one of the following is not an aggregate function? 1


i. ROUND()
ii. SUM()
iii. COUNT()
iv. AVG()
9. Which one of the following functions is used to find the largest value 1
from the given data in MySQL?
i. MAX( )
ii. MAXIMUM( )
iii. BIG( )
iv. LARGE( )

171
10. To display last five rows of a series object ‘S’, you may write: 1
i. S.Head()
ii. S.Tail(5)
iii. S.Head(5)
iv. S.tail()
11. Which of the following statement will import pandas library? 1
i. Import pandas as pd
ii. import Pandas as py
iii. import pandas as pd
iv. import panda as pd
12. Which of the following can be used to specify the data while creating a 1
DataFrame?
i. Series
ii. List of Dictionaries
iii. Structured ndarray
iv. All of these
13. Which amongst the following is not an example of a browser? 1
i. Chrome
ii. Firefox
iii. Avast
iv. Edge
14. In SQL, which function is used to display current date and time? 1
i. Date ()
ii. Time ()
iii. Current ()
iv. Now ()
15. Legal term to describe the rights of a creator of original creative or artistic 1
work is:
i. Copyright
ii. Copyleft
iii. GPL
iv. FOSS
16. is the trail of data we leave behind when we visit any website (or 1
use any online application or portal) to fill-in data or perform any
transaction.
i. Offline phishing
ii. Offline footprint
iii. Digital footprint
iv. Digital phishing
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct
choice as
i. Both A and R are true and R is the correct explanation for A
ii. Both A and R are true and R is not the correct explanation for A
iii. A is True but R is False
172
iv. A is false but R is True

17. Assertion (A): - Internet cookies are text files that contain small pieces 1
of data, like a username, password and user’s preferences while surfing
the internet.
Reasoning (R):- To make browsing the Internet faster & easier, its
required to store certain information on the server’s computer.

18. Assertion (A):- DataFrame has both a row and column index. 1

Reasoning (R): - A DataFrame is a two-dimensional labelled data


structure like a table of MySQL.

PART B
19. Explain the terms Web page and Home Page. 2

OR
Mention any four networking goals.

20. Rashmi, a database administrator needs to display house wise total 2


number of records of ‘Red’ and ‘Yellow’ house. She is encountering an
error while executing the following query:

SELECT HOUSE, COUNT (*) FROM STUDENT GROUP BY HOUSE


WHERE HOUSE=’RED’ OR HOUSE= ‘YELLOW’;

Help her in identifying the reason of the error and write the correct query
by suggesting the possible correction (s).
21. What is the purpose of Order By clause in SQL? Explain with the help of 2
suitable example.

22. Write a program to create a series object using a dictionary that stores 2
the number of students in each house of class 12D of your school.

Note: Assume four house names are Beas, Chenab, Ravi and Satluj
having 18, 2, 20, 18 students respectively and pandas library has been
imported as pd.
23. List any four benefits of e-waste management. 2
OR
Mention any four net etiquettes.

173
24. What will be the output of the following code: 2
>>>import pandas as pd
>>>A=pd.Series(data=[35,45,55,40])
>>>print(A>45)

25. Carefully observe the following code: 2

import pandas as pd Year1={'Q1':5000,'Q2':8000,'Q3':12000,'Q4': 18000}


Year2={'A' :13000,'B':14000,'C':12000}
totSales={1:Year1,2:Year2} df=pd.DataFrame(totSales) print(df)

Answer the following:


i. List the index of the DataFrame df
ii. List the column names of DataFrame df.

SECTION C
26. Write outputs for SQL queries (i) to (iii) which are based on the given 3
table PURCHASE:

TABLE: PURCHASE
CNO CNAME CITY QUANTITY DOP
C01 GURPREET NEW DELHI 150 2022-06-11
C02 MALIKA HYDERABAD 10 2022-02-19
C03 NADAR DALHOUSIE 100 2021-12-04
C04 SAHIB CHANDIGARH 50 2021-10-10
C05 MEHAK CHANDIGARH 15 2021-10-20
i. SELECT LENGTH(CNAME) FROM PURCHASE WHERE
QUANTITY>100;
ii. SELECT CNAME FROM PURCHASE WHERE
MONTH(DOP)=3;
iii. SELECT MOD (QUANTITY, DAY(DOP)) FROM PURCHASE
WHERE CITY= ‘CHANDIGARH’;
27. Write a Python code to create a DataFrame with appropriate column 3
headings from the list given below:

[[101,'Gurman',98],[102,'Rajveer',95],[103,'Samar' ,96],
[104,'Yuvraj',88]]

174
28. Consider the given DataFrame ‘Stock’: 3
Name Price
0 Nancy Drew 150
1 Hardy boys 180
2 Diary of a wimpy kid 225
3 Harry Potter 500
Write suitable Python statements for the following:
i. Add a column called Special_Price with the following
data: [135,150,200,440].
ii. Add a new book named ‘The Secret' having price 800.
iii. Remove the column Special_Price.
29. Nadar has recently shifted to a new city and school. She does not know 3
many people in her new city and school. But all of a sudden, someone is
posting negative, demeaning comments on her social networking profile
etc.

She is also getting repeated mails from unknown people. Every time she
goes online, she finds someone chasing her online.

i. What is this happening to Nadar?


ii. What immediate action should she take to handle it?
iii. Is there any law in India to handle such issues? Discuss briefly.

OR
What do you understand by plagiarism? Why is it a punishable offence?
Mention any two ways to avoid plagiarism.
30. Based on table STUDENT given here, write suitable SQL queries for 3
the following:

Roll No Name Class Gender City Marks


1 Abhishek XI M Agra 430
2 Prateek XII M Mumbai 440
3 Sneha XI F Agra 470
4 Nancy XII F Mumbai 492
5 Himnashu XII M Delhi 360
6 Anchal XI F Dubai 256
7 Mehar X F Moscow 324
8 Nishant X M Moscow 429
i. Display gender wise highest marks.
ii. Display city wise lowest marks.
iii. Display total number of male and female students.
OR
Discuss the significance of Group by clause in detail with the help of
suitable example.
SECTION D
175
31. Write suitable SQL query for the following: 5
i. Display 7 characters extracted from 7th left character onwards
from the string ‘INDIA SHINING’.
ii. Display the position of occurrence of string ‘COME’ in the string
‘WELCOME WORLD’.
iii. Round off the value 23.78 to one decimal place.
iv. Display the remainder of 100 divided by 9.
v. Remove all the expected leading and trailing spaces from a
column userid of the table ‘USERS’.
OR
Explain the following SQL functions using suitable examples.
i. UCASE()
ii. TRIM()
iii. MID()
iv. DAYNAME()
v. POWER()

32. Prime Computer services Ltd. is an international educational organization. 5


It is planning to set up its India campus at Mumbai with its head office in
Delhi. The Mumbai office campus has four main buildings-ADMIN,
ACCOUNTS, EXAMINATION and RESULT.

You as a network expert have to suggest the best network related


solutions for their problems raised in (i) to (v), keeping in mind the
distances between the buildings and other given parameters.

DELHI HEAD OFFICE EXAMINATION ADMIN

ACCOUNTS RESULT

Shortest distances between various buildings:


ADMIN TO ACCOUNTS 55 m
ADMIN TO EXAMINATION 90 m
ADMIN TO RESULT 50 m
ACCOUNTS TO EXAMINATION 55 m
ACCOUNTS TO RESULT 50 m
EXAMINATION TO RESULT 45 m
DELHI Head Office to MUMBAI CAMPUS 2150 m

Number of computers installed at various buildings are as


follows: ADMIN 110
ACCOUNTS 75
EXAMINATION 40

176
RESULT 12
DELHI HEAD OFFICE 20
(i) Suggest the most appropriate location of the server inside the
MUMBAI campus (out of the four buildings) to get the best
connectivity for maximum number of computers. Justify your
answer.
(ii) Suggest and draw cable layout to efficiently connect various
buildings within the MUMBAI campus for a wired connectivity.
(iii) Which networking device will you suggest to be procured by
the company to interconnect all the computers of various
buildings of MUMBAI campus?
(iv) Company is planning to get its website designed which will
allow students to see their results after registering themselves
on its server. Out of the static or dynamic, which type of website
will you suggest?
(v) Which of the following will you suggest to establish the online
face to face communication between the people in the ADMIN
office of Mumbai campus and Delhi head office?
a) Cable TV
b) Email
c) Video conferencing
d) Text chat

33. Write Python code to plot a bar chart for India’s medal tally as shown 5
below:

Also give suitable python statement to save this chart.


OR
Write a python program to plot a line chart based on the given data to
depict the changing weekly average temperature in Delhi for four weeks.

Week=[1,2,3,4]
Avg_week_temp=[40,42,38,44]
177
SECTION E
34. Shreya, a database administrator has designed a database for a clothing 1+1+2
shop.
Help her by writing answers of the following questions based on the given
table:TABLE: CLOTH

CCODE CNAME SIZE COLOR PRICE DOP


C001 JEANS XL BLUE 990 2022-01-21
C002 T SHIRT M RED 599 2021-12-12
C003 TROUSER M GREY 399 2021-11-10
C004 SAREE FREE GREEN 1299 2019-11-12
C005 KURTI L WHITE 399 2021-12-07
i. Write a query to display cloth names in lower case.
ii. Write a query to display the lowest price of the cloths.
iii. Write a query to count total number of cloths purchased of medium
size.

OR (Option for part iii only)

Write a query to count year wise total number of cloths


purchased.
35. Mr. Som, a data analyst has designed the DataFrame df that contains
data about Computer Olympiad with ‘CO1’, ‘CO2’, ‘CO3’, ‘CO4’, ‘CO5’ as
indexes shown below. Answer the following questions:

School Tot_students Topper First_Runnerup


CO1 PPS 40 32 8 1+1+2
CO2 JPS 30 18 12
CO3 GPS 20 18 2
CO4 MPS 18 10 8
CO5 BPS 28 20 8

A. Predict the output of the following python statement:


i. df.shape
ii. df[2:4]
B. Write Python statement to display the data of Topper column of
indexes CO2 to CO4.
OR (Option for part iii only)
Write Python statement to compute and display the difference of
data of Tot_students column and First_Runnerup column of the
above given DataFrame.

178
-S ET I V
CBSE SAMPLE QUESTION PAPER
MARKING SCHEME
CLASS XII - INFORMATICS PRACTICES (065)
TIME: 3 HOURS M.M.70
1. iii. MAN 1
1 mark for correct answer
2. ii. Installing antivirus for protection 1
1 mark for correct answer
3. iii. Unused old computers 1
1 mark for correct answer
4. iii. Null value 1
1 mark for correct answer
5. i. 20500 1
1 mark for correct answer
6. ii. Open 1
1 mark for correct answer
7. ii. SELECT COUNT (*) FROM ORDERS; 1
1 mark for correct answer
8. i. ROUND( ) 1
1 mark for correct answer
9. i. MAX () 1
1 mark for correct answer
10. iv. S.tail() 1
1 mark for correct answer
11. iii. import pandas as pd 1
1 mark for correct answer
12. iv. All of these 1

1 mark for correct answer


13. iii. Avast 1
1 mark for correct answer
14. iv. Now() 1
1 mark for correct answer
15. i. Copyright 1
1 mark for correct answer
16. iii. Digital footprint 1
1 mark for correct answer
17. iii. A is True but R is False 1
18. i. Both A and R are true and R is the correct explanation for A 1

179
19. Web Page: A Web Page is a part of a website and is commonly 2
written in HTML. It can be accessed through a web browser.
Home Page: It is the first web page you see when you visit a website.
1 mark for correct explanation of each term
Or
Four networking goals are:
i. Resource sharing
ii. Reliability
iii. Cost effective
iv. Fast data sharing
½ mark for each goal
20. The problem with the given SQL query is that WHERE clause should not 2
be used with Group By clause.
To correct the error, HAVING clause should be used instead of
WHERE. Corrected Query:
SELECT HOUSE, COUNT(*) FROM STUDENT GROUP BY HOUSE
HAVING HOUSE= ‘RED’ OR HOUSE=’YELLOW’;
1 Mark for error identification
1 Mark for writing correct query

21. Order By clause: 2


The ORDER BY command is used to sort the result set in ascending or
descending order.
The following SQL statement displays all the customer’s names in
alphabetical order:
SELECT Cname FROM Customers ORDER BY Cname;
1 mark for correct purpose
1 mark for correct example
22. St={‘Beas’ :18, ‘Chenab’ :20 , ‘ Ravi’ :20, ‘ Satluj’ 2
:18} S1=pd.Series(St)
1 mark for each correct python statement
23. The e-waste management- 2
i. Saves the environment and natural resources
ii. Allows for recovery of precious metals
iii. Protects public health and water quality
iv. Saves landfill space
½ mark for each benefit
Or
i. No copyright violation
ii. Share the expertise with others on the internet
iii. Avoid cyber bullying
iv. Respect other’s privacy and diversity
½ mark for each net etiquette
24. 2

½ mark for each correct output

180
25. i. The index labels of df will include Q1,Q2,Q3,Q4,A,B,C 2
ii. The column names of df will be: 1,2
1 mark for each correct answer
26. i. 8 3
ii. No Output
iii. 0
15
1 mark for each correct output

27. import pandas as pd 3


data=[[101,'Gurman',98],[102,'Rajveer',95],[103,'Samar' ,96],
[104,'Yuvraj',88]]
df=pd.DataFrame(data,columns=['Rno','Name', 'Marks'])

1 mark for each correct python statement


28. i. Stock['Special_Price']=[135,150,200,400] 3
ii. Stock.loc['4']=['The Secret',800]
iii. Stock=Stock.drop('Special_Price',axis=1)
1 mark for each correct statement
29. i. Nadar has become a victim of cyber bullying and cyber stalking. 3
ii. She must immediately bring it into the notice of her parents and
school authorities. And she must report this cyber crime to local
police with the help of her parents.
iii. Yes.
The Information Technology Act, 2000 (also known as ITA-2000,
or the IT Act) is the primary law in India dealing with cybercrime
and electronic commerce.

1 mark for each correct answer


OR

Ans. Plagiarism is the act of using or stealing someone else’s intellectual


work, ideas etc. and passing it as your own work. In other words, plagiarism
is a failure in giving credit to its source.
Plagiarism is a fraud and violation of Intellectual Property Rights. Since IPR
holds a legal entity status, violating its owners right is a legally punishable
offence.
Any two ways to avoid plagiarism:
 Be original
 Cite/acknowledge the source

1 mark for correct definition


1 mark for correct justification
½ mark each for any two ways to avoid plagiarism

181
30. i. select max(marks) from student group by gender; 3
ii. select min(marks) from student group by city;
iii. select gender,count(gender) from student group by gender;

1 mark for each correct query

OR
GROUP BY clause is used in a SELECT statement in combination with aggregate
functions to group the result based on distinct values in a column.

For example:

To display total number of male and female students from the table STUDENT,
we need to first group records based on the gender then we should count records
with the help of count() function.
Considering the following table STUDENT:
RollN Name Class Gender City Marks
o
1 Abhishek XI M Agra 430
2 Prateek XII M Mumbai 440
3 Sneha XI F Agra 470
4 Nancy XII F Mumbai 492
5 Himnashu XII M Delhi 360
6 Anchal XI F Dubai 256
7 Mehar X F Moscow 324
8 Nishant X M Moscow 429

SQL query for the above-mentioned task is as follows:


select gender,count(gender) from student group by gender;
Output:
Gender Count(Gender)
M 4
F 4

1 mark for correct significance 2


marks for correct example
31. i. select mid('INDIA SHINING',7,7); 5
ii. select INSTR('WELCOME WORLD','COME');
iii. select round(23.78,1);
iv. select mod(100,9);
v. select trim(userid) from users;

1 mark for each correct query

182
OR
1. UCASE(): It converts the string into upper case.
Example:
SELECT UCASE(‘welcome world’);
Output:

WELCOME WORLD

2. TRIM(): It removes the leading and trailing spaces from the given string.
Example:
SELECT TRIM(‘ Welcome world ‘ );
Output:
Welcome world
3. MID(): It extracts the specified number of characters from given string.
Example:
SELECT MID(‘ Welcome world,4,,4);
Output:
Come
4. DAYNAME(): It returns the weekday name for a given date
Example:
SELECT DAYNAME(‘2022-07-22’);
Output:
Friday
5. POWER(): It returns the value of a number raised to the power of another
number.
Example:
SELECT POW(6,2);
Output:
36

½ mark for each correct explanation


½ mark for each correct example
32 I) Server should be installed in Admin department as it has
maximum number of computers.
II) Star topology
EXAMINATION

ADMIN ACCOUNTS

RESULT
III) Hub/Switch
IV) Dynamic
V) Video conferencing

1 Mark for each correct answer

183
33. import matplotlib.pyplot as plt 5
Category=['Gold','Silver','Bronze']
Medal=[20,15,18]
plt.bar(Category,Medal)
plt.ylabel('Medal')
plt.xlabel('Medal Type')
plt.title('Indian Medal tally in Olympics')
plt.show()

½ mark for each correct statement


Python statement to save the chart:
plt.savefig("aa.jpg")
1 mark for the correct statement
OR
import matplotlib.pyplot as plt
Week=[1,2,3,4]
Avg_week_temp=[40,42,38,44]
plt.plot(Week,Avg_week_temp)
plt.show()

1 mark for each correct statement


34. i. SELECT LOWER(CNAME) FROM CLOTH; 1+1+2
ii. SELECT MIN(PRICE) FROM CLOTH;

1 mark for each correct query

iii. SELECT COUNT(*) FROM CLOTH GROUP BY SIZE HAVING


SIZE='M';
OR
SELECT YEAR(DOP),COUNT(*) FROM CLOTH GROUP BY
YEAR(DOP);

2 marks for correct query


35. A. Output: 1+1+2
i. (5,4)
ii. School tot_students Topper First_Runner_up
CO3 GPS 20 18 2
CO4 MPS 18 10 8

1 mark for each correct output


B. Python statement:
print(df.loc['CO2': 'CO4', 'Topper'])
OR

print(df.Tot_students-df.First_Runnerup)
2 marks for correct Python statement

184
Index
OTHER REFERENCES

1 CBSE Question Bank : https://cbseacademic.nic.in/web_material/QuestionBank/Class


XII/InformaticsPracticesXII.pdf

2 CBSE Sample QP https://cbseacademic.nic.in/SQP_CLASSXII_2021-22.html


2021-22:
3 CBSE Sample QP https://cbseacademic.nic.in/SQP_CLASSXII_2020-21.html
2020-21:
4 CBSE Curriculum https://cbseacademic.nic.in/web_material/CurriculumMain23/S
Informatics Practices rSec/Informatics_Practices_SrSec_2022-23.pdf
2022-23 :

185

You might also like