Xii Ip SSM Ahd 2023-24
Xii Ip SSM Ahd 2023-24
SESSION: 2023-24
1|Page
CHIEF PATRON
PATRON
2|Page
MENTOR
RAKSHA PARMAR, PGT (CS) ASHISH KUMAR CHAURDIA, MAYURI PATEL, PGT (CS)
KV SABARMATI PGT (CS) KV SILVASSA
KV NO. 2 EME, BARODA
MRS NAMRATA SHAH VIVEK KUMAR GUPTA KAMLESH AMIN, PGT (CS)
KV ONGC MEHSANA KV ONGC ANKLESHWAR KV NO. 3 SU JAMNAGAR
3|Page
INDEX
THEORY PART
PAGE NO.
UNIT UNIT NAME
NO.
FROM TO
1. SPLIT UP SYLLABUS 5 9
PRACTICAL PART
4|Page
KENDRIYA VIDYALAYA SANGATHAN: AHMEDABAD REGION
Month Wise Split up syllabus (Theory & Practical) 2023-24
Class: XII Subject: Informatics Practices (065) Max Marks: 70
Month Portion to be covered
April 2023 Unit 1: Data Handling using Pandas and Data Visualization
Data Handling using Pandas -I
Introduction to Python libraries- Pandas, Matplotlib. Data structures
in Pandas - Series and Data Frames.
Date Functions: NOW (), DATE (), MONTH (), MONTHNAME (), YEAR
(), DAY (), DAYNAME ().
Aggregate Functions: MAX (), MIN (), AVG (), SUM (), COUNT (),
using COUNT (*).
5|Page
Querying and manipulating data using Group by, Having, Order by.
Working with two tables using equi-join.
6|Page
Split up syllabus (Theory & Practical)
Class: XII Subject: Informatics Practices
Unit Unit Name Marks (Theory)
I Data Handling using Pandas and Data 25
Visualization
II Database Query using SQL 25
III Introduction to Computer Networks 10
IV Societal Impacts 10
Total 70
7|Page
Suggested Practical List:
A. Data Handling
1. Create a pandas series from a dictionary of values and an ndarray
2. Given a Series, print all the elements that are above the 75th percentile.
3. Create a Data Frame quarterly sales where each row contains the item
category, item name, and expenditure. Group the rows by the category and
print the total expenditure per category.
4. Create a data frame based on ecommerce data and generate descriptive
statistics (mean, median, mode, quartile, and variance)
5. Create a data frame for examination result and display row labels, column
labels data types of each column and the dimensions
6. Filter out rows based on different criteria such as duplicate rows.
7. Find the sum of each column, or find the column with the lowest mean.
B. Visualization
14. Given the school result data, analyse the performance of the students on
different parameters, e.g. subject wise or class wise.
15. For the Data frames created above, analyze and plot appropriate charts with
title and legend.
16. Take data of your interest from an open source (e.g. data.gov.in),
aggregate and summarize it. Then plot it using different plotting functions of
the Matplotlib library.
C. Data Management
17. Create a student table with the student id, name, and marks as attributes
where the student id is the primary key.
8|Page
18. Insert the details of a new student in the above table.
19. Delete the details of a particular student in the above table.
20. Use the select command to get the details of the students with marks more
than 80.
21. Create a new table (order ID, customer Name, and order Date) by joining
two tables (order ID, customer ID, and order Date) and (customer ID,
customer Name, contact Name, country).
22. Create a foreign key in one of the two tables mentioned above
23. Find the min, max, sum, and average of the marks in a student marks
table.
24. Find the total number of customers from each country in the table (customer
ID, customer Name, country) using group by.
25. Create a new table (name, date of birth) by joining two tables (student id,
name) and (student id, date of birth).
26. Write a SQL query to order the (student ID, marks) table in descending order of
the marks.
9|Page
Unit 1: Data Handling using Pandas
Introduction
Python Pandas Pandas is a software library written for the Python programming
language for data manipulation and analysis. Pandas is defined as an open-source
library that provides high-performance data manipulation in Python. The name of
Pandas is derived from the word Panel Data, which means an Econometrics from
Multidimensional data. It is used for data analysis in Python and developed by
Wes McKinney in 2008.
There are 3 well-established python libraries namely NumPy, Pandas and
Matplotlib specially for scientific and analytical use. These libraries allow us to
manipulate, transform and visualize data easily and efficiently.
Using the Pandas, we can accomplish five typical steps in the processing and
analysis of data, regardless of the origin of data. These steps are- load, prepare,
manipulate, model and analyze
Benefits of Pandas
The benefits of pandas over using the languages are
Data representation: It can easily represent data in a form naturally suited
for data analysis through its DataFrame and Series data structures in a
concise manner. Doing the equivalent in C/C++ or Java would require many
lines of custom code, as these languages were not built for data analysis
but rather networking and kernel development.
Clear code: The clear API of the Pandas allows you to focus on the core part
of the code. So, it provides clear code.
Matplotlib
It is an amazing visualization library in Python that used for 2D plots of arrays.
It is a multi-platform data visualization library which build NumPy arrays.
Matplotlib produces publication-quality figures in a variety of hardcopy formats
and interactive environments across platforms. Matplotlib can be used in Python
scripts, the Python and IPython shell, web application servers and various
graphical user interface toolkits. To get matplotlib up and running in our
environment, we need to import it. import matplotlib.pyplot as plt.
Data structures in Pandas:
Data structure is defined as the storage and management of the data for its
efficient and easy access in the future where the data is collected, modified and
the various types of operations are performed on the data respectively. Pandas
provides two data structures for processing the data, which are explained below:
(1) Series: It is one dimensional object similar to an array, list or column in a
table. It will assign a labelled index to each item in the series. By default, each
item will receive an index label from 0 to N, where N is the length of the series
minus one.
10 | P a g e
(2) DataFrame: It is a tabular data structure comprised of rows and columns.
DataFrame is defined as a standard way to store data which has two different
indexes i.e., row index and column index.
11 | P a g e
● Scalar value or constant
Create an Empty Series
A basic series, which can be created is an Empty Series.
1. Write a program to create an empty series
Ans.
import pandas as pd
s =pd.Series()
print (s)
Output is as follows: Series ([], dtype: float64)
Create a Series from List
2. Write a program to create a series by given list [‘red’,’green’,’blue’].
Ans.
import pandas as pd
c=[‘red’,’green’,’blue’]
p=pd.Series(c)
print (p)
OR
import pandas as pd
c=[‘red’,’green’,’blue’]
p=pd.Series(data=c)
print (p)
OR
import pandas as pd
p=pd.Series([‘red’,’green’,’blue’])
print (p)
Output:
0 red
1 green
2 blue
We did not pass any index, so by default, it assigned the indexes ranging from 0
to len(data)-1, i.e., 0 to 2.
12 | P a g e
print (p)
OR
import pandas as pd
p=pd.Series([‘red’,’green’,’blue’],index=[r,g,b])
print (p)
OR
import pandas as pd
c=[‘red’,’green’,’blue’]
p=pd.Series(c,[r,g,b])
print (p)
OR
import pandas as pd
c=[‘red’,’green’,’blue’]
p=pd.Series(data=c,index=[r,g,b])
print (p)
Output:
r red
g green
b blue
Output
0 1
1 Aman
2 86.3
3 A
13 | P a g e
Create a Series from Dictionary
A dictionary can be passed as input and if no index is specified, then keys of the
dictionary are used to represent the index of the Series.
5. A dictionary data ={‘a’:0.,’b’:1.,’c’:2} is given.
Write a program to create series from dictionary data.
Ans.
import pandas as pd
data ={‘a’:0.,’b’:1.,’c’:2.}
s =pd.Series(data)
print(s)
Its output is as follows –
a 0.0
b 1.0
c 2.0
dtype: float64
If index is passed, the values will be displayed in the same sequence as index
values are passed.
import pandas as pd
data ={‘a’:0.,’b’:1.,’c’:2.}
s =pd.Series(data,index=[‘b’,’c’,’a’])
print(s)
Its output is as follows –
b 1.0
c 2.0
a 0.0
You can also show the specified values by giving their keys as index values.
6. Modify the above program and display values of ‘a’ and ‘c’ only.
Ans.
import pandas as pd
data ={‘a’:0.,’b’:1.,’c’:2.}
s =pd.Series(data,index=[‘a’,’c’])
print(s)
14 | P a g e
Its output is as follows –
a 0.0
c 2.0
If index value is passed other than keys value then NaN (Not a Number) as value
will be displayed.
As you can see the “5” is printed 4 times because the length of index is 4.
15 | P a g e
Create a Series from ndarray
Ans.
2 Raj
5 Ankur
6 Harsh
6 Harsh
2 Raj
5 Ankur
import pandas as pd
name=[‘Raj’,’Ankur’,’Harsh’]
p=pd.Series(name,index=[2,5,6])
print(p) p1=p.reindex([2,5])
print (p1)
Ans.
2 Raj
5 Ankur
6 Harsh
dtype: object
2 Raj
5 Ankur
dtype: object
if other than existing index value is provided to reindex then NaN will be
displayed.
import pandas as pd
name=[‘Raj’,’Ankur’,’Harsh’]
p=pd.Series(name,index=[2,5,6])
print(p) p1=p.reindex([2,4,5])
print (p1)
Ans.
2 Raj
5 Ankur
6 Harsh
dtype: object
2 Raj
4 NaN
5 Ankur
dtype: object
17 | P a g e
ALTER INDEX VALUES
The Series index function does not only allow you to display the index items, but
you can also alter it as well. This example changes the actual index items and
places the integer values as the index.
14. Give the output:
import pandas as pd
S = pd.Series([10,20,30,40,50], index = [‘a’, ‘e’, ‘i’, ‘o’, ‘u’])
print(S)
# Assigning New Index Values
S.index = [1, 2, 3, 4, 5]
print(“Series after new index values”)
print(S)
Ans.
a 10
e 20
i 30
o 40
u 50
dtype: int64
SIZE ATTRIBUTE
All pandas data structures are value-mutable (the values they contain can be
altered). All pandas data structures are size mutable except Series. The length of
a Series cannot be changed, i.e. number of columns and rows can’t be altered
once defined. Series is size immutable.
import pandas as pd
L=[10,20,30]
S=pd.Series(L)
print(S.size)
Ans. 3
18 | P a g e
PRACTICE QUESTIONS
1. What is series? Explain with the help of an example.
Ans. Pandas Series is a one-dimensional labeled array capable of holding data
of any type (integer, string, float, python objects, etc.). The axis labels
are collectively called index.
Example:
import pandas as pd # simple array
data =pd.Series([1,2,3,4,5])
print(data)
2. Write a suitable Python code to create an empty series.
Ans.
import pandas as pd
s=pd.Series()
print (s)
3. Write single line Pandas statement to declare a Pandas series named
Packets having dataset as: [125, 92, 104, 92, 85, 116, 87, 90]
Ans. Packets = pd.Series([125, 92, 104, 92, 85, 116, 87, 90])
4. Write single line Pandas statement to declare a Pandas series named S
having dataset as: (44,65,35,77,87,90)
Ans. S=pd.Series((44,65,35,77,87,90))
5. Write single line Pandas statement to declare a Pandas series named SR
having dataset as: {1:’one’,2:’two’,3:’three’}
Ans. SR=pd.Series({1:’one’,2:’two’,3:’three’})
6. Write python code to create the Series EMP with following data (using
Dictionary)
Ans.
import pandas as pd
d={“E1”:”Sanya”,”E2”:”Krish”,”E3”:Rishav”,”E4”:”Deepak”}
EMP=pd.Series(d)
EMP.index.name=”code”
19 | P a g e
print(EMP)
7. Write python series to print scalar value “100” 5 times with index
values(1,2,3,4,5)
Ans.
import pandas as pd
s = pd.Series(100, index=[1, 2, 3, 4,5])
OR
s = pd.Series(100, [1, 2, 3, 4,5])
print (s)
8. Write python code to create the following series using Dictionary:
101 Harsh
102 Arun
103 Ankur
104 Harpahul
105 Divya
106 Jeet
Ans:
import pandas as pd
D={101:“Harsh”,102:”Arun”,103:”Ankur”,104:”Harpahul”,105:”Divya”
,106:”Jeet” }
s=pd.Series(D)
print(s)
9. Write a program to create a series by using given an array [‘a’,’b’,’c’,’d’]
and assign index values 100,101.....
Ans.
import pandas as pd
import numpy as np
data =np.array([‘a’,’b’,’c’,’d’])
s =pd.Series(data,index=[100,101,102,103])
print(s)
Its output is as follows –
20 | P a g e
100 a
101 b
102 c
103 d
dtype: object
10. Give the output:
import pandas as pd
s =pd.Series(10, index=[5,6,7,9])
print(s)
Ans.
5 10
6 10
7 10
9 10
ACCESSING DATA
Accessing using head()
By default Series.head() function display top 5 rows. To print n no of top rows,
pass n as parameter i.e. Series. head(n)
17. Write a code to create a series from empno list and show the first five
ro rows empno = [101,102,103,104,105,106,107]
Ans.
import pandas as pd
p=pd.Series(empno)
print (p.head())
output:
0 101
1 102
2 103
3 104
4 105
21 | P a g e
18. Using the above series write a single line statement to show the first
rows using head()
Ans. print(p.head(3))
output:
0 101
1 102
2 103
Accessing using tail()
By default Series.tail() function display last 5 rows. To print n no of last rows,
pass n as parameter i.e. Series. tail(n)
19. Write a code to create a series from empno list and show the last five
rows empno=[101,102,103,104,105,106,107]
Ans.
import pandas as pd
p=pd.Series(empno)
print (p.tail())
output:
2 103
3 104
4 105
5 106
6 107
20.Fill the missing statements
import pandas as pd L=[101,102,103,104,105,106,107]
_ = pd.Series(L) #statement 1
print (p.___(3)) #statement 2
output:
4 105
5 106
6 107
Ans.
p=pd.Series(L) #statement 1
print (p.tail(3)) #statement 2
22 | P a g e
Indexing
Pandas now supports three types of indexing.
(i) loc: is label based indexing.
(a) A single label
21. Give the output:
import pandas as pd
s=pd.Series([10,20,30,40,50],index =[‘a’,’b’,’c’,0,1])
print(s.loc[‘a’])
print(s.loc[0])
Ans.
10
40
# in loc[0], 0 is interpreted as a label of the index. This is not an integer
position along the index.
(b) A list of labels
22. Give the output:
import pandas as pd
s=pd.Series([10,20,30,40,50],index =[‘a’,’b’,’c’,0,1])
print(s.loc[[‘b’,’c’,1]])
Ans.
b 20
c 30
1 50
(c) A slice object with labels
A slice is a subset of series elements.
my_series[start:stop:step] where start is the index of the first element
to include, stop is the index of the item to stop and step sets the interval
23 | P a g e
23. Give the output:
import pandas as pd
s=pd.Series([10,20,30,40,50],index =[‘a’,’b’,’c’,0,1])
print(s.loc[‘a’:’c’])
Ans.
a 10
b 20
c 30
Note: Both the start and the stop are included, when present in the label
index
(ii) iloc: integer position based.
This series can also be indexed by position (using integers) even though
it has string index entries! The first item is at key 0, and the last item is
at key -1
(a) input an integer
24. Give the output:
import pandas as pd
s=pd.Series([10,20,30,40,50],index =[‘a’,’b’,’c’,0,1])
print(s.iloc[0])
Ans. 10
(b) input a list of integers
25. Write a program to print the values of 0,2,4 positions from Series
s[10,20,30,40,50] using .iloc.
Ans.
import pandas as pd
s=pd.Series([10,20,30,40,50],index =[‘a’,’b’,’c’,0,1])
print(s.iloc[[0,2,4]])
output
a 10
c 30
1 50
24 | P a g e
26. Write a program to print the values of 0,2,4 positions from Series
s[10,20,30,40,50] using .iloc.
Ans. import pandas as pd
s=pd.Series([10,20,30,40,50],index =[‘a’,’b’,’c’,0,1])
print(s.iloc[[0,2,4]])
output
a 10
c 30
1 50
(c) input a slice object with ints
A slice is a subset of series elements. my_series[start:stop:step] where
start is the index of the first element to include, stop is the index of the
item to stop without including the stop value and step sets the interval.
27. Show the first 3 values from Series using iloc.
Ans.
import pandas as pd
s=pd.Series([10,20,30,40,50],index =[‘a’,’b’,’c’,0,1])
print(s.iloc[0:3])
a 10
b 20
c 30
(iii) with [ ]: Accessing Data from Series with Position and Using Label (index).
By using [] you can take advantage of both .loc and .iloc. You can access
the records using [] directly.
If index value is not defined you can pass default index value 0,1,2... to
access the elements.
If string index values are defined then elements can be accessed by both
ways: passing default index values (0,1,2...) or passing defined string
index values.
If integer index values are defined, [] will work only as .loc i.e. elements
can be accessed by passing defined index values only.
25 | P a g e
28. Give the output:
import pandas as pd
M=[15,-10,56,39,-90,15]
p=pd.Series(M)
print(p[0])
print(p[[0,3,4]])
Ans.
15
0 15
3 39
4 -90
29. Give the output of the following program:
import pandas as pd
s=pd.Series([10,20,30,40,50],index=[‘a’,’b’,’c’,’d’,’e’])
print(s[0]) #or print(s.iloc[0])
print(s[‘a’:’c’]) #or print(s.loc[‘a’:’c’])
print(s[2]) #or print(s.iloc[s[2])
print(s[‘a’]) #or print(s.loc[‘a’])
Its output is as follows –
Ans.
10
a 10
b 20
c 30
30
10
26 | P a g e
30. PRACTICE QUESTIONS
(i) Write python code to create the following series
101 Harsh
102 Arun
103 Ankur
104 Harpahul
105 Divya
106 Jeet
(ii) Show details of 1st 3 employees using head function
(iii) Show details of last 3 employees using tail function
(iv) Show details of 1st 3 employees without using head function
(v) Show details of last 3 employee without using tail function
(vi) Show value of index no 102
(vii) Show 2nd to 4th records
(viii) Show values of index no=101,103,105
(ix) Show details of “Arun”
Ans.
(i) import pandas as pd
name=[‘Harsh’,’Arun’,’Ankur’,’Harpahul’,’Divya’,’Jeet’]
p=pd.Series(name,index=[101,102,103,104,105,106])
print (p)
(ii) print (p.head(3))
(iii) print (p.tail(3))
(iv) print(p[:3]) or pirnt(p.loc[101:103]) or print(p.iloc[0:3]) or
print(p[[101,102,103]])
(v) print (p[-3:]) or print(p[3:]) or print(p[[104,105,106]])
(vi) print(p[102]) or print(p.loc[102])
(vii) print(p[1:4])
(viii) print(p[[101,103,105]])
(ix) print(p[p= =’Arun’])
27 | P a g e
Accessing data from a Series with Position
We can also access data from a Series by passing the position value and even
through slicing. Using a series, we can access any position values through
index by the corresponding number to retrieve values.
Eg: import pandas as pd
S = pd.Series([10,20,30,40,50], index = [‘a’,’b’,’c’,’d’,’e’])
print(S[0]) # for 0 index position
print(S[:3]) # for first 3 index position
print(S[-3:]) # for last 3 index position
print(S[-4])
print(S[3:])
print(S[2:4])
Output:
10
a 10
b 20
c 30
dtype: int64
c 30
d 40
e 50
dtye: int64
20
d 40
e 50
dtype: int64
c 30
d 40
28 | P a g e
dtype: int64
Naming a Series
We can also give name to the columns, index and values of a Series using
‘name’ property.
29 | P a g e
Eg: import pandas as pd
s = pd.Series({‘Jan’:31, ‘Feb’:28, ‘Mar’:31})
s.name = ‘Days’
s.index.name = ‘Month’
print(s)
Output:
Month
Jan 31
Feb 28
Mar 31
Name: Days, dtype: int64
Note that the index column is assigned the name Month and data is assigned
the name Days, displayed at the bottom of the Series.
Series Object Attributes:
We can obtain various properties of a Series through its attributes. Some
common attributes of Series are:
Attribute Description
index Returns index of the series
values Return ndarray of values
dtype Returns dtype object of underlying
data
shape Returns tuple of the shape of
underlying data
nbytes Returns number of bytes of
underlying data
ndim Returns the number of dimension
size Returns number of elements
hasnans Return True if there are any NaN
empty Returns True if Series object is empty
30 | P a g e
Eg: Consider three series s1, s2, s3 and output obtained after mathematical
operations on them
>>>s1 >>>s2 >>>s3
1 11 1 21 101 21
2 12 2 22 102 22
3 13 3 23 103 23
4 14 4 24 104 24
dtype: int64 dtype: int64 dtype: int64
31 | P a g e
>>>s+2
0 13
1 14
2 15
3 16
dtype: int64
>>>s>13
0 False
1 False
2 False
3 True
dtype: bool
Note: Original series does not change after dropping the element.
***********
33 | P a g e
DataFrame
A pandas DataFrame is a two (or more) dimensional data structure – basically
a table with rows and columns. The columns have names and the rows have
indexes. For instance, the price can be the name of a column and 2,3 the price
values.
A picture of a Pandas DataFrame is shown alongside:
In general, you could say that the Pandas DataFrame consists of
three main components: the data, the index, and the columns.
A pandas DataFrame can be created using the following constructor pandas.
DataFrame (data, index, columns, dtype, copy).
The parameters of the constructor are as follows:
34 | P a g e
Q. Write python code to create the DataFrame emp using dictionary:
Name Salary
101 Rohan 20000
102 Aman 25000
Ans.
import pandas as pd
emp=
pd.DataFrame({‘Name’:[‘Rohan’,’Aman’],’Salary’:[20000,25000]},
index=[101,102]);
print(emp)
or
import pandas as pd
Dic= {‘Name’:[‘Rohan’,’Aman’],’Salary’:[20000,25000]}
emp = pd.DataFrame(Dic,index=[101,102]);
print(emp)
Iterating in Pandas DataFrame
Iteration is a general term for taking each item of something one after
another. In Pandas DataFrame, we can iterate an element in two ways:
(i) Iterating over rows:
35 | P a g e
(ii) Iterating over columns
head() and tail() methods or functions are used to view a small sample of
a DataFrame object. These functions are described below
(i) head():
This function returns the first n rows for the object based on position.
It is useful for quick testing if your object has the right type of data
in it.
36 | P a g e
Q. Give the output:
import pandas as pd
Dic={‘empno’:(101,102,103,104,105,106),’grade’:(‘a’,’b’,’a’,’c’,’b’,’c’) ,
’dept’: (‘sales’,’pur’,’mar’,’sales’,’pur’,’mar’)}
df=pd.DataFrame(Dic)
print(df.head(3))
Output:
empno grade dept
0 101 a sales
1 102 b pur
2 103 a mar
(ii) tail():
This function returns last n rows from the object based on position. It is
useful for quickly verifying data. e.g. after sorting
37 | P a g e
df=pd.DataFrame(Dic)
print(df.tail())
Ans.
empno grade dept
1 102 b pur
2 103 a mar
3 104 c sales
4 105 b pur
5 106 c mar
Syntax: DataFrame.loc
Boolean Indexing:
It helps us to select the data from the DataFrames using a boolean vector.
We need a DataFrame with a boolean index to use the boolean indexing.
In boolean indexing, we can filter a data in four ways:
Accessing a DataFrame with a boolean index
Applying a boolean mask to a DataFrame
Masking data based on column value
Masking data based on index value
38 | P a g e
CSV FILES
CSV (Comma-separated values) files are the comma separated values.
This type of file can be view as an excel file and separated by commas. CSV
file is nothing more than a simple text file. However, it is the most common,
simple and easiest method to store tabular data. This particular format
arranges tables by a specific structure divided into rows and columns.
Once we have the DataFrame, we can persist it in CSV on the local disk. Let’s
first create CSV file using data that is currently present in the DataFrame, we
can store the data of this DataFrame in CSV format using API called to_CSV
(…) of Pandas
Importing/Exporting Data between CSV files and DataFrames
Pandas read_csv() function is used to import a CSV file to DataFrame format.
Syntax:
df.read_csv('file_name.CSV', header=None)
Here, Header allows you to specify which row will be used as column names
for your DataFrame. Expected int value or a list of int values.
If your file does not have a header, then simply set header=None
To export a Pandas DataFrame to a CSV file, use to_csv function.
This saves a DataFrame as a CSV file.
Syntax:
to_csv(parameters)
39 | P a g e
Ans.
import pandas as pd
Dic={‘empno’:(101,102,103,104),’name’:(‘a’,’b’,’c’,’d’),
’salary’:(3000,5000,8000,9000)}
df=pd.DataFrame(Dic)
df.to_csv(r”D:\software\a.csv”) # or df.to_csv(“D:\\software\\a.csv”)
Read CSV File as Pandas Using the read_csv() function from the pandas
package, you can import tabular data from CSV files into pandas
DataFrame:
3. Write python code to read a csv file “test.csv” from D:\
Ans.
import pandas as pd
df = pd.read_csv(‘d:\\test.csv’) #read the csv file
print(df)
How to Create CSV File in Excel
Step 1: Open excel and write data in worksheet
Step 2: Select file option from menu and click on save as ...
Step 3: Select drive and folder name where you want to save csv file
Step 4: Click on save as type option and select csv option from list.
Step 5: Click on save button
************
40 | P a g e
Data Visualization
Data visualization is the presentation of data in graphical format. It helps
people understand the significance of data by summarizing and presenting a
huge amount of data in a simple and easy to understand format and helps
communicate information clearly and effectively
Matplotlib
It is an amazing visualization library in Python that used for 2D plots of arrays.
It is a multi-platform data visualization library which build NumPy arrays.
Matplotlib produces publication-quality figures in a variety of hardcopy formats
and interactive environments across platforms. Matplotlib can be used in
Python scripts, the Python and IPython shell, web application servers and
various graphical user interface toolkits.
To get matplotlib up and running in our environment, we need to import it.
import matplotlib.pyplot as plt
Case Study Based MCQs
Ans: (b)
(ii) Name the label that can be used to represent the bar chart in Line 2.
(a) Data (b) Data Values
(b) Values for X axis (d) All of these
Ans: (d)
41 | P a g e
(a) X values (b) Y values
(c) Legend (d) Vertical
Ans: (a)
(iv) Which method will take place at Line 6 for setting heading on the top
of Chart?
Ans: (b)
(v) Choose the statement to be place at Line7 of the above code.
Ans: (b)
2. If you are given to plot a histogram using numpy array as per
the code given below then answer any of four question from (i)
to (v)
42 | P a g e
(c) pyplot (d) plot
Ans: (c)
(v) To fill in blank on Line 10 for showing histogram what can bee
used?
Ans: plt.show()
3. Consider the following case and answer the from (i) to (v)
import …………. as pd
import matplotlib. _____ as plt
data= {‘Name’ : [‘Karan’, ‘Adi’, ‘Abhinav’, ‘Kirti’, ‘Rahul’ ],
‘Height’ : [60,61,63,65,61],
‘Weight’ : [47,89,52,58,50,47]}
df=pd. _________ (data)
43 | P a g e
df._____ (Kind =’hist’, edgecolor = ‘Green’, linewidth =2, linestyle=’:’ ,
fill= False)
_____________
Ans: (c)plot
44 | P a g e
1. What is true about Data Visualization?
Ans: D
2. Which method is used to save the output of pyplot in the form of image
file?
A. savefig(‘filename’)
B. save_fig(‘filename)
C. save_figure(‘filename’)
D. save_img(‘filename’)
Answer: A
Answer: B
45 | P a g e
4. The command used to give a heading to a graph is _________
A. plt.show()
B. plt.plot()
C. plt.xlabel()
D. plt.title()
Answer: D
A. Politics
B. Sales and marketing
C. Healthcare
D. All of the above
Answer: D
Ans: A
Ans: C
8. Which one of the following is most basic and commonly used techniques?
A. Line charts
B. Scatter plots
C. Population pyramids
D. Area charts
46 | P a g e
Answer: A
Explanation: Line charts. This is one of the most basic and common
techniques used. Line charts display how variables can change over time.
A. matplotlib.pyplot
B. matplotlib.pip
C. matplotlib.numpy
D. matplotlib.plt
ANS: A
10. Observe the output figure. Identify the coding for obtaining this output.
plt.plot([1,2,3],[4,5,1])
plt.show()
plt.plot([1,2],[4,5])
plt.show()
plt.plot([2,3],[5,1])
plt.show()
plt.plot([1,3],[4,1])
plt.show()
ANS: A
12. Identify the right type of chart using the following hints.
47 | P a g e
Hint 1: This chart is often used to visualize a trend in data over intervals of
time.
ANS: A
13. Which of the following method will be add inside the file to display plot?
A. show()
B. display()
C. plot()
D. execute()
ANS: show()
A. horizontal_bar()
B. barh()
C. hbar()
D. bar()
ANS: C
A. his()
B. hist()
C. Hist()
D. histogram()
ANS: B
48 | P a g e
DATABASE USING SQL
Revision of SQL
49 | P a g e
Data type indicates the type of data value that an attribute can have
and the operations that can be performed on the data of that attribute
FLOAT Holds numbers with decimal points. Each FLOAT value occupies 4
bytes.
DATE The DATE type is used for dates in 'YYYY-MM-DD' format. YYYY is the
4 digit year, MM is the 2 digit month and DD is the 2 digit date
CONSTRAINTS:
50 | P a g e
SQL queries:
DDL Commands
1. CREATE DATABASE Syntax : Example :
CREATE DATABASE CREATE DATABASE EMP_DATA;
<DBNAME>;
2. For using /opening Syntax : Example :
Database USE <DBNAME>; USE EMP_DATA;
3. To show all available Syntax : Example :
databases SHOW DATABASES; SHOW DATABASES;
4. To create table Syntax : Example :
CREATE TABLE CREATE TABLE EMP
<table_name> (EMPNO INT ,
(<col_name> ENAME VARCHAR(20),
<datatype> <size> SALARY INT);
constraint,
<col_name> CREATE TABLE EMP
<datatype> <size> (EMPNO INT PRIMARY KEY,
constraint,---------- ENAME VARCHAR(20),
); SALARY INT);
51 | P a g e
5. Describe table Syntax : Example :
DESCRIBE
– can view the <TABLE_NAME>;
structure of the table
OR
52 | P a g e
INSERT INTO STUDENT
(ROLLNO,SNAME,SDOB)
VALUES (20, ‘SHEENA’, ‘2009-10-
13’);
Syntax: Example :
SELECT * FROM SELECT * FROM STUDENT;
tablename;
To display only ROLLNO and
2) To display selected SNAME from STUDENT table.
columns and all
rows SELECT ROLLNO, SNAME FROM
Syntax: STUDENT;
SELECT
<colname>,<colname
>.. FROM To display all details whose rollno
<tablename>; is less than 15.
53 | P a g e
Output:-
Output:-
54 | P a g e
13. Membership Syntax:
Operator – IN SELECT * FROM
<tablename>
The IN operator WHERE <colname> IN
(<val1>,<val2>…);
compares a value
with a set of values
and returns true if
the value belongs to
that set.
By default displays
records in ascending
order
Output:-
Output:-
Output:-
56 | P a g e
Displays details of all those
employees whose name ends with
'a'.
57 | P a g e
SQL Joins:
Process of accessing data from multiple tables is called Join in SQL
JOIN operation combines tuples from two tables on specified
conditions. This is unlike cartesian product, which make all possible
combinations of tuples
Example : List the Ucode, Uname, Ucolor, size and Price of related
tuples of table UNIFORM and COST.
(a) SELECT * FROM UNIFORM U, COST C where U.Ucode = C.Ucode;
Equi Join
The SQL Equi join is a simple join clause where the relation is
established using equal to sign as the relational operator to mention
the condition.
58 | P a g e
The join in which columns are compared for equality is called equi-join.
A non equi join specifies condition with non-equality operator. In equi-
join we put (*) in the select list will print common column twice in the
output.
Example :
Equi Join – Inner join is used to return the records which are having
matching values in both the tables
An Equi Join is a type of join that combines tables based on matching values
in the specified columns.
❖ The column names do not need to be the same.
❖ The resultant table can contain repeated columns.
❖ It is possible to perform an equi join on more than two
Equi Join- ❖ It performs a JOIN against equality or matching column(s)
values of the associated tables.
SELECT * /Column_list
FROM Table1, Table 2
WHERE table1.column=Table2.column;
Or
SELECT * /Column_list
FROM Table1 join Table2 on Table1.Column=Table2.Column;
59 | P a g e
Example: SELECT * FROM emp JOIN dept ON emp.deptno=dept.deptno;Or
SELECT * FROM emp, dept WHERE emp.deptno=dept.deptno;
Example 1: Display the employee name, sal and name of department name
Ans: In the above query ename and sal belong to emp table whereas
dname belongs
toDEPT table. So, to retrieve data in this we will use join
SELECT emp.ename, emp.sal, dept.dname
FROM emp, dept WHERE emp.deptno=dept.deptno;
Output:
++++
| ename | sal | dname |
++++
| SMITH | 800.00 | RESEARCH |
| ALLEN | 1600.00 | SALES |
| WARD | 1250.00 | SALES |
| JONES | 2975.00 | RESEARCH |
| MARTIN | 1250.00 | SALES |
| BLAKE | 2850.00 | SALES |
| CLARK | 2450.00 | ACCOUNTING |
| SCOTT | 3000.00 | RESEARCH |
| KING | 5000.00 | ACCOUNTING |
| TURNER | 1500.00 | SALES |
| ADAMS | 1100.00 | RESEARCH |
| JAMES | 950.00 | SALES |
| FORD | 3000.00 | RESEARCH |
| MILLER | 1300.00 | ACCOUNTING |
Note:
60 | P a g e
FUNCTION in MySQL
Function:
A function is a predefined command set that performs some operation and
returns the single value. A function can have single, multiple or no arguments
at all.
61 | P a g e
ii. LOWER() / LCASE()
iii. UPPER()/UCASE()
iv. LTRIM()
v. TRIM()
vi. RTRIM()
vii. SUBSTR()/MID()
viii. INSTR(),
ix. LENGTH()
x. RIGHT()
xi. LEFT()
3) Date Functions:
i. SYSDATE()
ii. NOW()
iii. DATE()
iv. MONTH()
v. YEAR()
vi. DAYNAME()
vii. MONTHNAME()
viii. DAY()
Math Functions:
1.Pow(x,y )/power(x,y): Returns the value of X raised to the power
of Y.
Example:
(i)Select POW(2,4); Result:16
62 | P a g e
(ii)SELECT POW(2,-2; Result:0.25
(iii)SELECT POW(-2,3); Result: -8
(iv)SELECT id, salary, POWER(salary,2) FROM employee;
Result:
+----+----------+-----------------+
| id | salary | power(salary,2) |
+----+----------+-----------------+
| 1 | 25000.00 | 625000000 |
| 2 | 30000.00 | 900000000 |
| 3 | 32000.50 | 1024032000.25 |
| 4 | 37500.50 | 1406287500.25 |
| 5 | 42389.50 | 1796869710.25 |
+----+----------+-----------------+
2.ROUND(X): Rounds the argument to zero decimal place, whereas
ROUND(X, d) rounds X to d decimal places.
Example:
(i) ROUND(-1.23); Result: -1
(ii) ROUND(-1.68); Result: -2
(iii) ROUND(1.58); Result: 2
(iv) ROUND(3.798, 1); Result: 3.8
(v) ROUND(1.298, 0); Result: 1
(vi) ROUND(76823.298, -1); Result: 76820
(vii) ROUND( 25.298,-1); Result: 30
(viii) ROUND(3.798, 1); Result: 3.8
(ix) ROUND(4536.78965,-3) Result: 5000
(X) ROUND(4536.564553,-2): Result: 4500
(XI) ROUND(4586.564553,-2): Result: 4600
(XII)ROUND(76823.298, -2); Result:76800
XII)ROUND(76823.298, 2); Result: 76823.30
(XIII) ROUND(3.798, 2); Result: 3.80
63 | P a g e
3. MOD(x,y): Divides x by y and gives the remainder.
(i)SELECT MOD(12,5); Result: 2
+--------------------+
| LENGTH(First_Name) |
+--------------------+
|4|
|7|
|8|
|5|
|6|
+--------------------+
5 rows in set (0.00 sec)
64 | P a g e
| INSTR(First_Name,'Kiran') |
+---------------------------+
|0|
|0|
| 4 | Select instr(“good morning to all”,”or”)
|0|
|0|
+---------------------------+
Example:
SELECT UCASE(‘informatics’); Result: INFORMATICS
65 | P a g e
9. MID()/ SUBSTR(): Returns a substring starting from the specified
position in a given string.
Example:
(i) SUBSTR(‘INFORMATICS PRACTICES’,3,4); Result: FORM
(ii) SELECT SUBSTRING('Informatics',3); Result:'formatics'
(iii) SELECT SUBSTRING('Computers', -3); Result: 'ers'
(iv) SELECT SUBSTRING('Computers', -5, 3); Result: 'ute'
(v) SELECT MID('Informatics',3,4); Result: 'form'
(vi) SELECT MID(first_name,3,2) FROM Employee;
Result:
+---------------------+
| MID(first_name,3,2) |
+---------------------+
| it |
| ek |
| vk |
| mt |
| aw |
+---------------------+
10. LTRIM(): Removes leading spaces.
Example:
SELECT LTRIM(' INFORMATICS '); Result: 'INFORMATICS’
66 | P a g e
Date/Time Functions
1. NOW(): Returns the current date and time
Example:
select NOW(); Result: '2020-04-06 13:58:11'
67 | P a g e
Aggregate functions summarize the results of a query and return a
single value calculated from values in a column instead of providing
the listing of all of the rows.
Syntax:
SELECT <FUNCION> (column_name) FROM <table_name>;
The following are aggregate functions:
3) MAX(): It returns the maximum value among the given set of values of
any column or expression based on column.
Example: SELECT MAX(MARKS) FROM STUDENT;
It displays maximum marks from the column marks of student table.
4) MIN(): It returns the minimum value among the given set of values of
any column or expression based on column.
Example: SELECT MIN (MARKS) FROM STUDENT;
It displays minimum marks from the column marks of student table.
68 | P a g e
If the argument is an * then COUNT() counts the total number of records /
rows along with the NULL values satisfying the condition, if any, in the table.
So, it returns the total number of records or rows from the table.
69 | P a g e
[where <condition>]
ORDER BY <column_name> [ASC/DESC] , <column_name> [ASC/DESC];
Example: To display the roll number, name and marks of all the
students in descending order of their marks and ascending order of
their names.
SELECT ROLLNO, NAME , MARKS FROM STUDENT
ORDER BY MARKS DESC, NAME;
GROUP BY in SQL
At times we need to fetch a group of rows on the basis of common
values in a column. This can be done using a GROUP BY clause.
It groups the rows tog-ether that contain the same values in a
specified column. We can use the aggregate functions (COUNT, MAX,
MIN, AVG and SUM) to work on the grouped values.
HAVING Clause in SQL is used to specify conditions on the rows with
GROUP BY clause.
Syntax:
SELECT <column1, column2…..> , aggregate function(colname)
FROM <tablename>
WHERE <condition>
GROUP BY <column1>
HAVING <condition>;
70 | P a g e
(i) Write a query to display number of cars purchased by each
customer from the SALE Table.
mysql> SELECT CustID, COUNT(*) "Number of Cars" FROM SALE
GROUP BY CustID;
71 | P a g e
(iv) Display the payment mode and number of payments made
using that mode more than once.
mysql> SELECT PaymentMode, Count(PaymentMode) FROM SALE
GROUP BY Paymentmode HAVING COUNT(*)>1 ORDER BY
Paymentmode;
1 Write down name of four functions that can be used with Group by?
72 | P a g e
5.You have a table “Company” having column cno, cname, department
and salary. Write SQL statement to display average salary of each
department.
Ans SELECT department, avg(salary) from company
Group by department;
6. Can a Group by clause be used for more than one column? If yes,
given an example.
Ans Yes.
Select name, grade, class
From student
Group by Class, grade
7. Anis has given the following command to arrange the data in
ascending order of date.
Select * from travel where order by tdate;
But he is not getting the desired result.
Help him by choosing the correct command.
a. Select * from travel order by tdate;
b. Select * from travel in ascending order;
c. Select tdate from travel order by tdate;
Ans. Select * from travel order by tdate;
8. Find the output of the following SQL queries:
i. SELECT ROUND(7658.345,2); O/P – 7658.35
ii. SELECT MOD(ROUND(13.9,0),3); o/p - 2
9. Give any two differences between POWER() and SUM().
Ans: POWER(x,y) – will return value x power to y
SUM() – Aggregate function, and returns sum of values of one column
10. Find the output of the following SQL queries:
i. SELECT SUBSTR(‘FIT INDIA MOVEMENT’,5);
O/P – INDIA MOVEMEMNT
ii. SELECT INSTR(‘ARTIFICIAL INTELLIGENCE’, ‘IA’);
O/P - 8
73 | P a g e
UNSOLVED QUESTIONS
74 | P a g e
ii. instr( )
iii. now( )
Empid Salary
1 45000
2 50000
3 55000
4 40000
5 NULL
Write the output of the following:
i. Select mod(Salary, 100) from emp;
ii. Select average(Salary) from emp;
iii. Select sum(Salary) from emp where empid > 3;
iv. Select max(Salary) from emp;
75 | P a g e
ii. select left(dayname(now()),5)
iii. select length('Informatics Practice Class 12’);
OR
Explain the functions with suitable example to do this:
i. To find the position of specific word or character in the given text
ii. Display the total number characters from the text
iii. To display remainder of given two numbers
12) Vats is working with functions of MySQL. Explain him the following with
example:
i. To remove extra leading spaces from the text
ii. To return only day part from today’s date
iii. To return average of particular column from the table
13) Om has written following queries:
i. select count(*) from student;
ii. select count(std_no) from student;
He was surprised with the output as query (i) returns 5 rows whereas
Query(ii) returns only 3 rows. Explain why?
14) Which functions in MySQL extract words from specified character to n
number of character from given string. Write the function names and explain
them with example.
15) Anuj is student of class XII, trying to execute the following queries, help
him to predict the output.
i. select round (45.9,-2);
ii. select round ( -101.86,0)
76 | P a g e
INTRODUCTION TO COMPUTER NETWORK
Introduction to Networks:
A group of two or more similar things or people interconnected with each
other is called network
Types of networks
o Social network
o Mobile network
o Network of computers
o Airlines, railway, banks, hospitals networks
A computer network is an interconnection among two or more
computers or computing devices which allows computers to share data
and resources among each other.
Apart from computers, networks include networking devices like switch,
router, modem, etc. Networking devices are used to connect multiple
computers in different settings.
Types of Networks
77 | P a g e
The geographical area covered by a LAN
can range from a single room, a floor, an
office having one or more buildings in the
same premise, laboratory, a school,
college, or university campus
Connected with wires, Ethernet cables,
fibre optics or Wi-Fi
LANs provide the short-range communication with the high-speed data
transfer rates
Can be extended up to 1 km
Data transfer from 10 Mbps to 1000 Mbps (Mbps- Megabits per
Second)
Metropolitan Area Network (MAN)
Metropolitan Area Network (MAN) is an
extended form of LAN which covers a larger
geographical area like a city or a town.
Data transfer rate is less than LAN
E.g.: Cable TV Network, Cable based
broadband internet
Can be extended up to 30-40 kms
many LANs are connected together to form MAN
78 | P a g e
x
Network Devices:
To communicate data through different transmission media and to configure
networks with different functionality, we require different devices like Modem,
Hub, Switch, Repeater, Router, Gateway, etc.
Modem:
79 | P a g e
The modem at the sender’s end acts as a modulator that converts the
digital data into analog signals. The modem at the receiver’s end acts
as a demodulator that converts the analog signals into digital data for
the destination node
Ethernet Card
Repeater
Hub
80 | P a g e
The limitation of hub is that if data from two devices come at the same
time, they will collide
Types of Hub-
Switch
1. The main difference between hub and switch is that hub replicates
what it receives on one port ontoall the other ports while switch
keeps a record of the MAC addresses of the devices attached to it and
forwards data packets onto the ports for which it is addressed across a
network, that’s why switch is intelligent Hub.
81 | P a g e
Router
A network device that can receive the data, analyse it and transmit it
to other networks.
Compared to a hub or a switch, a router has advanced capabilities as it
can analyse the data being carried over a network, decide or alter how
it is packaged, and send it to another network of a different type.
A router can be wired or wireless.
A wireless router can provide Wi-Fi access to smartphones and other
devices.
Wi-Fi routers perform the dual task of a router and a modem/switch
It connects to incoming broadband lines, from ISP (Internet Service
Provider), and converts them to digital data for computing devices to
process.
Gateway
82 | P a g e
it can be implemented as software, hardware, or a combination of both
because network gateway is placed at the edge of a network and the
firewall is usually integrated with it.
Network Topologies
1 Mesh Topology
Disadvantages:
2 Ring Topology
3 Bus Topology
83 | P a g e
data transmitted in both directions
data can be received by any of
the nodes of network
single backbone wire /bus
used to connect computers so
cheaper and easy to maintain
Disadvantages:
less secure
less reliable
4 Star Topology
Advantages:
Easy to troubleshoot
very effective, efficient and fast
A single node failure does not affect the
entire network.
Fault detection and removal of faulty parts is easier.
In case a workstation fails, the network is not affected.
Disadvantages: -
84 | P a g e
5 Tree or Hybrid Topology
The Internet
85 | P a g e
• Electronic mail (Email)
• Chat
• Voice Over Internet Protocol (VoIP)
1 The World Wide Web (WWW)
86 | P a g e
It is one of the ways of sending and receiving message(s) using the
Internet.
can be sent anytime to any number of recipients at anywhere
To use email service, one needs to register with an email service
provider by creating a mail account. These services may be free or paid.
Some of the popular email service providers are Google (Gmail), Yahoo
(yahoo mail), Microsoft (outlook), etc.
Application of Internet
Web 2.0:
The term web 2.0 is used to refer to a new generation of websites that
are supposed to let people to publish and share information online. It
aims to encourage the sharing of information and views, creativity that
can be consume by the other users. E.g.: YouTube
Makes web more interactive through online social media web- based
forums, communities, social networking sites.
It is a website design and development world which aim to encourage
sharing of information and views, creativity and user interactivity
between the users.
Video sharing possible in the websites
Web 3.0: It refers to the 3rd Generation of web where user will interact by
using artificial intelligence and with 3-D portals.
Web 3.0
keywords
supports andweb
semantic numbers.
which improves web technologies to create,
connect and share content through the intelligent search and the
analysis based on the meaning of the words, instead of on the
87 | P a g e
3 Chat
4 VoIP
Advantage of VoIP:
Save a lot of money.
More than two people can communicate or speak.
Supports great audio transfer.
Provide conferencing facility.
can transfer text, image, video along w ithvoice
Disadvantages of VoIP:
88 | P a g e
7 Website
1 Purpose of a Website
89 | P a g e
Static web pages are generally written in HTML, JavaScript and/or CSS
and have the extension .htm or .html.
a dynamic web page is one in which the content of the web page can be
different for different users.
Dynamic web pages can be created using various languages such as
JavaScript, PHP, ASP.NET, Python, Java, Ruby, etc.
Difference between Static and Dynamic webpage: -
The static web pages display the In the dynamic Web pages, thepage
same content each time when content changes according to the
someone visits it. user.
It takes less time to load over Dynamic web pages take more
internet. time while loading.
Website Webpage
90 | P a g e
2. Has content about various Has content about single entity.
entity.
9 Web Server
Web Hosting: -
online service that enables user to publish website or web
application on the internet. When user sign up for a hosting
service, basically rent some space on a server on which user can
store all the files and data necessary for website to work properly.
A server is a physical computer that runs without any interruption
so that website is available all the time for anyone who wants to
see it.
11 Browser:
software application that helps us to view the web page(s).
91 | P a g e
Helps to view different contents retrieved from different web servers
on the internet
Mosaic was the first web
browser developed by the
National Centre for
Supercomputing Application
(NCSA).
Mozilla Firefox is an open source
web browser which is available free of cost and can be easily
downloaded from the Internet.
Browser Setting
Every web browser has got certain settings that define the manner in
which the browser will behave. These settings may be with respect to
privacy, search engine preferences, download options, auto signature,
autofill and autocomplete feature, theme and much more.
Add-ons and plug-ins are the tools that help to extend and modify the
functionality of the browser.
Both the tools boost the performance of the browser, but are different
from each other.
A plug-in is a complete program or may be a third-party software. For
example, Flash and Java are plug-ins. A Flash player is required to play
a video in the browser. A plug-in is a software that is installed on the
host computer and can be used by the browser for multiple
functionalities and can even be used by other applications as well.
an add-on is not a complete program and so is used to add only a
particular functionality to the browser. An add-on is also referred to as
extension in some browsers
92 | P a g e
Cookies
A cookie is a text file, containing a string of information, which is
transferred by the website to the browser when we browse it.
This string of information gets stored in the form of a text file in the
browser.
The information stored is retransmitted to the server to recognize the
user, by identifying pages that were visited, choices that were made
while browsing various menu(s) on a particular website.
It helps in customizing the information that will be displayed, for
example the choice of language for browsing, allowing the user to auto
login, remembering the shopping preference, displaying
advertisements of one’s interest, etc. Cookies are usually harmless and
they can’t access information from the hard disk of a user or transmit
virus or malware.
93 | P a g e
SOLVED QUESTIONS
NETWORKING (4 MARKS QUESTIONS)
1. Multipurpose Public School, Bengaluru is setting up the
network between its different wings of school campus. There are 4
wings named as: -
(i) Suggest the best wired medium and draw the cable layout to
efficiently connect various wings of Multipurpose Public School,
Bengaluru.
(ii) Name the most suitable wing where the servers should be installed.
Justify your answer.
(iii) Suggest a device/software and its placement that would provide data
security for the entire network of the school.
(iv) Suggest a device and a protocol that shall be needed to provide
wireless internet access to all smartphone/laptop users in the campus
of Multipurpose Public School, Bengaluru.
b
(i) Best wired medium: Optical fibre/CAT5/CAT6/CAT7/CAT8/Ethernet
Cable.
Layout:
94 | P a g e
(ii) Wing Senior (S)- Because it has maximum number of computers.
(iii) Firewall- Placed with the Server at SENIOR(S).
(iv) DEVICE NAME: WiFi Router/WiMax/Wireless modem
Protocol: WAP/TCP-IP/VoIP/MACP
95 | P a g e
Note:
• In Villages, there are community centres, in which one room has been
given as training center to this organiza¬tion to install computers.
• The organization has got financial support from the government and top IT
companies.
1. Suggest the most appropriate location of the SERVER in the YHUB (out
of the 4 locations), to get the best and effective connectivity. Justify
your answer.
2. Suggest the best wired medium and draw the cable layout (location to
location) to efficiently connect vari¬ous locations within the YHUB.
96 | P a g e
3. Which hardware device will you suggest to connect all the computers
within each location of YHUB?
4. Which server/protocol will be most helpful to conduct live interaction of
Experts from Head office and people at YHUB locations?
Answers:
(i) YTOWN
Justification
Layout:
97 | P a g e
The distance between various buildings is as follows:
98 | P a g e
Answers:
1.
99 | P a g e
1. Suggest a suitable Topology for networking the computers of all wings.
2. Name the most suitable wing where the Server should be installed.
Justify your answer.
3. Suggest where all should Hub(s)/Switch(es) be placed in the network.
4. Which communication medium would you suggest to connect this
school with its main branch in Delhi?
Answers:
1.
2. Server should be in Wing S as it has the maxi-mum number of
computers. 1
3. All Wings need hub/switch as it has more than
one computer.
4. Since the distance is more, wireless transmission would be better.
Radiowaves are reliable and can travel through obstacles.
100 | P a g e
1. What will be the most appropriate block, where TTC should plan to
install their server?
2. Draw a block to cable layout to connect all the buildings in the most
appropriate manner for efficient communication.
3. What will be the best possible connectivity out of the following, you will
suggest to connect the new setup of offices in Bangalore with its
London based office:
o Satellite Link
o Infrared
o Ethernet Cable
4. Which of the following device will be suggested by you to connect each
computer in each of the buildings:
o Switch
o Modem
o Gateway
o
101 | P a g e
Answers:
1. Finance block because it has maximum
number of computers.
2. Satellite link
3. Switch
102 | P a g e
1. Suggest the most suitable block in the Bengaluru Office Setup, to host
the server.
Give a suitable reason with your suggestion.
2. Suggest the cable layout among the various blocks within the
Bengaluru Office Setup for
connecting the Blocks.
3. Suggest a suitable networking device to be installed in each of the
blocks essentially required for connecting computers inside the blocks
with fast and efficient connectivity.
4. Suggest the most suitable media to provide secure, fast and reliable
data connectivity between Delhi Head Office and the Bengaluru Office
Setup.
103 | P a g e
Answers:
1. Human Resources because it has maximum number of computers.
2. Switch 1
3. Satellite link
104 | P a g e
Block to Block Distances (in Mtrs.)
1. Suggest the most appropriate block, where RCI should plan to install
the server.
2. Suggest the most appropriate block to block cable layout to connect all
three blocks for efficient communication.
3. Which type of network out of the following is formed by connecting the
computers of these three blocks?
o LAN
o MAN
o WAN
4. Which wireless channel out of the following should be opted by RCI to
connect to students from all over the world?
o Infrared
o Microwave
o Satellite
105 | P a g e
Answers:
1. Faculty Recording Block.
2. Star topology
3. LAN
4. Satellite connection
106 | P a g e
No village is more than 20 km away from the state capital.
Imagine yourself as a computer consultant for this project and answer the
following questions with justification:
1. Out of the following what kind of link should be provided to setup this
network: Microwave link, Radio Link, Wired Link?
2. What kind of network will be formed; LAN, MAN, or WAN?
3. Many times, doctors at village hospital will have to consult senior
doctors at the base hospital. For this purpose, how should they contact
them: using email, SMS, telephone, or video conference?
Answers:
1. Radio Link
2. MAN
3. e-mail
107 | P a g e
1. Suggest the most suitable place (i.e., building) to house the server of
this organization. Also give a reason to justify your suggested location.
2. Suggest a cable layout of connections between the buildings inside the
campus.
3. Suggest the placement of the following devices with justification:
o Repeater.
o Switch.
4. The organization is planning to provide a high-speed link with its head
office situated in Mumbai using a wired connection. Which of the
following cables will be most suitable for this job?
o Optical Fiber
o Co-axial Cable
o Ethernet Cable
Answer:
108 | P a g e
1. The most suitable place to install server is building “RED” because this
building has maximum computer which reduce communication delay.
2. (a) Since the cabling distance between buildings GREEN, BLUE and RED
are quite large, so a repeater each, would ideally be need along their
path to avoid loss of signals during the course of data flow in their
routes.
109 | P a g e
(b) In the layout a switch each, would be needed in all the buildings, to
interconnect the group of cables from the different computers in each
building.
110 | P a g e
10) Granuda Consultants are setting up a secured network for their
office campus at Faridabad for their day to day office and web-based
activities. They are planning to have connectivity between 3 building
and the head office situated in Kolkata. Answer the questions (i) to
(iv) after going through the building positions in the campus and
other details, which are given below:
111 | P a g e
1. Suggest the most suitable place (i.e., block) to house the server of this
organization. Also give a reason to justify your suggested location.
2. Suggest a cable layout of connections between the buildings inside the
campus.
3. Suggest the placement of the following devices with justification:
o Repeater
o Switch
4. The organization is planning to provide a high-speed link with its head
office situated in the KOLKATA using a wired connection. Which of the
following cable will be most suitable for this job?
o Optical Fibre
o Co-axial Cable
o Ethernet Cable
Answer:
1. The most suitable place to install server is building “JAMUNA” because
this building has maximum computer which reduce the communication
delay.
2. Cable layout. (Bus topology).
112 | P a g e
3. (a) Since the cabling distance between buildings GANGA and JAMUNA
are quite large, so a repeater each, would ideally be needed along their
path to avoid loss of signals during the course of data flow in these
routes.
(b) In the layout a switch each would be needed in all the building, to
interconnect the group of cables from the different computers in
each building.
4. Optical fiber
Mudra publishing
113 | P a g e
Distance between various Blocks:
1. Block A to Block C is 50 m
2. Block A to Block D is 100 m
3. Block B to Block C is 40 m
4. Block B to Block D is 70 m
5. Block C to Block D is 125 m
Number of Computers
6. Block A is 25
7. Block B is 50
8. Block C is 20
9. Block D is 120
114 | P a g e
4. The organization is planning to link the whole blocks to its marketing
Office in Delhi. Since cable connection is not possible from Shimla,
suggest a way to connect it with high speed.
Answer:
115 | P a g e
4 Marks Unsolved Questions
[ CASE STUDY]
City No. of
Computers
116 | P a g e
In continuation of the above, the company experts have planned to install the
following number of computers in each of their offices:
i. Suggest the most suitable place (i.e., Block/Center) to install the server of
this organization with a suitable reason.
ii. Suggest an ideal layout for connecting these blocks/centers for a wired
connectivity.
iii. Which device will you suggest to be placed/installed in each of these offices
to efficiently connect all the computers within these offices?
iv. Suggest the placement of a Repeater in the network with justification.
v. The organization is planning to connect its new office in Delhi, which is more
than 1250 km current location. Which type of network out of LAN, MAN, or
WAN will be formed? Justify your answer.
117 | P a g e
(a) What will be the most appropriate block where organization should plan to
install their server?
(b) Draw a block-to-block cable layout to connect all the buildings in the most
appropriate manner for efficient communication.
(c) Which of the following devices will you suggest to connect each computer
in each of the above buildings?
(i) Gateway
(ii) Switch
(iii) Modem
(d) Write names of any two popular web browsers.
118 | P a g e
Center to Center distances between various blocks/center is as follows
a) Suggest the most suitable place (i.e., Block/Center) to install the server of
this University with a suitable reason.
b) Suggest an ideal layout for connecting these blocks/centers for a wired
connectivity.
119 | P a g e
c) Which device will you suggest to be placed/installed in each of these
blocks/centers to efficiently connect all the computers within these
blocks/centers.
d) Suggest the placement of a Repeater in the network with justification.
e) The university is planning to connect its admission office in Delhi, which is
more than 1250km from university.
Which type of network out of LAN, MAN, or WAN will be formed? Justify your
answer.
120 | P a g e
5)Quick Learn University is setting up its academic blocks at Prayag
Nagar and planning to set up a network. The university has 3
academic blocks and one human resource Centre as shown in the
diagram given below:
121 | P a g e
(a) Suggest a cable layout of connection between the blocks.
(b) Suggest the most suitable place to house the server of the organization
with suitable reason.
(c) Which device should be placed/installed in each of these blocks to
efficiently connect all the computers within these blocks?
122 | P a g e
(d) The university is planning to link its sales counters situated in various parts
of the other cities. Which type of network out of LAN, MAN or WAN will be
formed?
(e) Which network topology may be preferred in each of these blocks?
6) Rehaana Medicos Center has set up its new center in Dubai. It has
four buildings as shown in the diagram given below:
123 | P a g e
As a network expert, provide the best possible answer for the following
queries:
124 | P a g e
(i) Suggest an ideal cable layout for connecting the above UNITs.
(ii) Suggest the most suitable place i.e. UNIT to install the server for the above
NGO.
(iii) Which network device is used to connect the computers in all UNITs?
(iv) Suggest the placement of Repeater in the UNITs of above network.
125 | P a g e
i) Suggest the kind of network required (out of LAN, MAN, WAN) for
connecting each of the following office units:
a. Production Unit and Media Unit
b. Production Unit and Finance Unit
ii) Which of the following devices will you suggest for connecting all the
computers within each of their office units?
126 | P a g e
*Switch/Hub *Modem *Telephone
iii) Suggest a cable layout for connecting the company’s local office units in
Chennai.
iv) Suggest the most suitable place to house the server for the organization
with suitable reason.
9)Rehaana Medicos Center has set up its new center in Dubai. It has
four buildings as shown in the diagram given below:
127 | P a g e
As a network expert, provide the best possible answer for the following
queries:
i) Suggest a cable layout of connections between the buildings.
ii) Suggest the most suitable place (i.e. buildings) to house the server of
this organization.
iii) Suggest the placement of the Repeater device with justification.
128 | P a g e
Computers in each building are networked but buildings are not networked
so far. The Company has now decided to connect building also.
(i) Suggest a cable layout for connecting the buildings
(ii) Do you think anywhere Repeaters required in the campus? Why
(iii) Where server is to be installed? Why?
129 | P a g e
130 | P a g e
Note:
* In Villages, there are community centres, in which one room has been given
as training center to this organization to install computers.
* The organization has got financial support from the government and top IT
companies.
1. Suggest the most appropriate location of the SERVER in the YHUB (out of
the 4 locations), to get the best and effective connectivity. Justify your
answer.
2. Suggest the best cable layout (location to location) to efficiently connect
various locations within the YHUB.
3. Which hardware device will you suggest to connect all the computers within
each location of YHUB?
131 | P a g e
ABBREVIATIONS RELATED TO COMPUTER NETWORK
1 NIU Network Interface Unit
12 RJ Registered Jack
132 | P a g e
27 HTTP Hyper Text Transfer Protocol
133 | P a g e
SOCIETAL IMPACTS
Societal Impacts
In the past few decades there has been a revolution in computing and
communications, and all indications are that technological progress and use
of information technology will continue at a rapid pace. Accompanying and
supporting the dramatic increases in the power and use of new information
technologies has been the declining cost of communications as a result of both
technological improvements and increased competition. According to Moore’s
law the processing power of microchips is doubling every 18 months. These
advances present many significant opportunities but also pose major
challenges. Today, innovations in information technology are having wide-
ranging effects across numerous domains of society, and policy makers are
acting on issues involving economic productivity, intellectual property rights,
privacy protection, and affordability of and access to information. Choices
made now will have long lasting consequences, and attention must be paid to
their social and economic impacts. One of the most significant outcomes of
the progress of information technology is probably electronic commerce over
the Internet, a new way of conducting business. Though only a few years old,
it may radically alter economic activities and the social environment. Already,
it affects such large sectors as communications, finance and retail trade and
might expand to areas such as education and health services. It implies the
seamless application of information and communication technology along the
entire value chain of a business that is conducted electronically. The following
sections will focus on the impacts of information technology and electronic
commerce on business models, commerce, market structure, workplace, labor
market, education, private life and society as a whole.
Digital Footprint
A digital footprint is data that is left behind when users have been online.
There are two types of digital footprints which are passive and active.
A passive footprint is made when information is collected from the user
without the person knowing this is happening.
An active digital footprint is where the user has deliberately shared
information about themselves either by using social media sites or by using
websites.
An example of a passive digital footprint would be where a user has been
online and information has been stored on an online database. This can include
where they came from, when the footprint was created and a user IP address.
A footprint can also be analyzed offline and can be stored in files which an
administrator can access. These would include information on what that
machine might have been used for, but not who had performed the actions.
134 | P a g e
An example of an active digital footprint is where a user might have logged
into a site when editing or making comments such as on an online forum or a
social media site. The registered name or profile can be linked to the posts
that have been made and it is surprisingly easy to find out a lot about a person
from the trails you leave behind.
1. Be respectful.
2. Be aware of how your comments might be read:
3. Be careful with humor and sarcasm
4. Think about who can see what you have shared.
5. Remember to check friend requests and group invites before accepting
them.
6. Take time to have a read of the rules of conduct/ community standards.
7. Be forgiving.
Data Protection
Data protection is a set of strategies and processes you can use to secure the
privacy, availability, and integrity of your data. It is sometimes also called
data security or information privacy. A data protection strategy is vital for any
organization that collects, handles, or stores sensitive data.
Although both data protection and privacy are important and the two often
come together, these terms do not represent the same thing.
One addresses policies, the other mechanisms
Data privacy is focused on defining who has access to data while data
protection focuses on applying those restrictions. Data privacy defines the
policies that data protection tools and processes employ.
Creating data privacy guidelines does not ensure that unauthorized users don’t
have access. Likewise, you can restrict access with data protections while still
leaving sensitive data vulnerable. Both are needed to ensure that data
remains secure.
Another important distinction between privacy and protection is who is
typically in control. For privacy, users can often control how much of their data
is shared and with whom. For protection, it is up to the companies handling
data to ensure that it remains private. Compliance regulations reflect this
difference and are created to help ensure that users’ privacy requests are
enacted by companies.
135 | P a g e
Data Protection Technologies and Practices that Can Help You Protect
User Data
When it comes to protecting your data, there are many storage and
management options you can choose from. Solutions can help you restrict
access, monitor activity, and respond to threats. Here are some of the most
commonly used practices and technologies:
1. Data loss prevention (DLP)—a set of strategies and tools that you can use
to prevent data from being stolen, lost, or accidentally deleted. Data loss
prevention solutions often include several tools to protect against and recover
from data loss.
3. Firewalls—utilities that enable you to monitor and filter network traffic. You
can use firewalls to ensure that only authorized users are allowed to access or
transfer data.
136 | P a g e
Intellectual Property Rights
Property
Intellectual Property
These are certain rights or privileges granted for the owner ship of scholarly,
intelligent, knowledgeable logical work is referred as Proprietary when it
becomes Copyrighted or Registered.
137 | P a g e
Proprietary is synonyms for Trademarked, Branded, Patented or private
operated usually for commercial purposes.
Antonym of proprietary is Generic.
Work like registered Domain names, Industrial designs, confidential
information, Inventions, Program and Database rights and literacy
works of authorship or recorded performances in physical or abstract
forms.
Copyright
Plagiarism
138 | P a g e
It is presenting someone else's work in form of words, views, ideas, images,
sounds or the creative expression and performance as your own work in
following ways: -
i. Whether it is an idea or either published or unpublished material;
ii. Whether in hard copy manuscript, design or softcopy or electronic form;
Licensing:
Software Licensing is the legal right to run or the privilege gives to you by a
company to access their application or program or software.
139 | P a g e
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. This is in contrast to proprietary software, where the
software is under restrictive copyright licensing and the source code is usually
hidden from the users.
Free software
The freedom to run the program as you wish, for any purpose (freedom
0).
The freedom to study how the program works and change it so it does
your computing as you wish (freedom 1). Access to the source code is
a precondition for this.
The freedom to redistribute copies so you can help others (freedom 2).
The freedom to distribute copies of your modified versions to others
(freedom 3). By doing this you can give the whole community a chance
to benefit from your changes. Access to the source code is a precondition
for this.
Cyber Crime:
140 | P a g e
network to reach other computers in order to disable or damage data or
services.
Apart from this, a cybercriminal may spread viruses and other malwares in
order to steal private and confidential data for blackmailing and extortion. A
computer virus 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. Similarly, malware is a software designed to specifically gain
unauthorized access to computer systems. The nature of criminal activities
are alarmingly increasing day-by-day, with frequent reports of hacking,
ransomware attacks, denial-of-service, phishing, email fraud, banking fraud
and identity theft.
141 | P a g e
considered a single, distinctive crime but covers a range of illegal and illicit
actions that are committed in cyberspace.
5. Cyber Stalking:
This is a kind of online harassment wherein the victim is subjected to a barrage
of
online messages and emails. In this case, these stalkers know their victims
and
instead of offline stalking, they use the Internet to stalk. However, if they
notice that cyber stalking is not having the desired effect, they begin offline
stalking along with cyber stalking to make the victims’ lives more miserable.
Hacking:
142 | P a g e
to the website owner. Thus, ethical hacking is actually preparing the owner
against any cyber-attack.
Phishing is an unlawful activity where fake websites or emails that look original
or authentic are presented to the user to fraudulently collect sensitive and
personal details, particularly usernames, passwords, banking and credit card
details. The most common phishing method is through email spoofing where
a fake or forged email address is used and the user presumes it to be from an
authentic source. So, you might get an email from an address that looks
similar to your bank or educational institution, asking for your information.
Cyber Bullying
Any insulting, degrading or intimidating online behaviour like repeated posting
of rumors, giving threats online, posting the victim’s personal information,
sexual harassment or comments aimed to publicly ridicule a victim is termed
as cyber bullying. It implies repeatedly targeting someone with intentions to
hurt or embarrass. We need to realize that bullying online can have very
serious implications on the other person (victim).
Identity Theft:
143 | P a g e
computer system, using password of another person, publishing sensitive
personal data of others without their consent, etc. The act is needed so that
people can perform transactions over the Internet through credit cards
without fear of misuse.
E-waste broadly covers waste from all electronic and electrical appliances and
comprises of items such as computers, mobile phones, digital music
recorders/players, refrigerators, washing machines, televisions (TVs) and
many other household consumer items.
E-Waste Hazards
E-Waste Management
144 | P a g e
Awareness about health concerns related to the use of Technology
1. Neck strain
2. Vision Problem
3. Sense of isolation
4. Sleeping disorder
5. Stress
6. Loss of attention
8. Computer anxiety
145 | P a g e
(iii) Whenever we surf the Internet using smartphones we leave a trail of
data reflecting the activities performed by us online, which is our
___________
a. Digital footprint c. Online handprint
b. Digital activities d. Internet activities
Q2. Shobhit is eager to know the best way to behave on internet. Help him
to know the concepts of net and communication etiquettes.
(iii) Online posting of rumors, giving threats online, posting the victim’s
personal information, comments aimed to publicly ridicule a victim is termed
as __________
a. Cyber bullying c. Cyber insult
b. Cybercrime d. All of the above
146 | P a g e
Q.3 Namita has recently shifted to new city and new school. She does not
know many people in her new city and school. But all of a student, someone
is posting negative, demeaning comments on her social networking profile,
school site’s forum etc.
She is also getting repeated mails from unknown people. Every time she goes
online, she finds someone chasing her online.
a) What is this happening to Namita?
i. Namita has become a victim of cyber bullying and cyber stalking.
ii. Eaves dropping
iii. Scam
iv. Violation of IPR
147 | P a g e
Very Short Answer Type Questions (1 mark)
1. In which year the Indian IT Act, 2000 got updated?
2. What is data privacy?
3. Which of the following is not a type of cyber-crime?
a) Data theft c) Damage to data and systems
b) Forgery d) Installing antivirus for protection
Answer: d
Explanation: Cyber-crimes is one of the most threatening terms that is an
evolving phase. It is said that major percentage of the World War III will be
based on cyber-attacks by cyber armies of different countries.
Answer:c
Explanation: Cyber-crime can be categorized into 2 types. These are peer-
to-peer attack and computer as weapon. In peer-to-peer attack, attackers
target the victim users; and in computer as weapon attack technique,
computers are used by attackers for a mass attack such as illegal and
banned photo leak, IPR violation, pornography, cyber terrorism etc.
Answer: b
Explanation: In the year 2008, the IT Act, 2000 was updated and came up
with a much broader and precise law on different computer-related crimes
and cyber offenses.
148 | P a g e
MLL BASED QUESTIONS (Short Answer Type Questions-2 MARKS)
1. Sumit got good marks in all the subjects. His father gifted him a laptop. He
would like to make Sumit aware of health hazards associated with
inappropriate and excessive use of laptop. Help his father to list the points
which he should discuss with Sumit.
2. What do you mean by Cyber Crime, explain its types and write the
measures to avoid it?
149 | P a g e
Practical List
1. Write a python program to create a series to print scalar value
“5” five times.
Note: Assume four house names are Raman, Shivaji, Ashok and Tagor
having 34, 42, 29, 58 students respectively.
151 | P a g e
Kriti XI 45
1. Write a statement to get the minimum value of the column marks.
2. Write a statement to get the maximum value of the column marks.
3. Write a statement to get the sum value of the column marks.
4. write a statement to get the average value of the column marks.
5. Write a statement to get Transpose of DataFrame student_df
6. Write a statement to get the sorted value of the column marks.
7. Write a statement to get the sorted value of the column name ascending.
8. Write a statement to get the sorted value of the column name descending.
9. Write a statement to get the sort index of DataFrame
10. Write a statement to get the sorted column index of DataFrame.
11. Write a statement to get top 3 rows and bottom 2 rows from dataframe
16. Write a program to create a horizontal bar chart for India's medal
tally.
Australia 80 59 59 198
England 45 45 46 136
India 26 20 20 66
Canada 15 40 27 82
153 | P a g e
17. Manisha has created following table named exam:
Help her in writing SQL queries to the perform the following task:
i. Insert a new record in the table having following values:
[6,'Khushi','CS',85]
ii. To change the value “IP” to “Informatics Practices” in subject column.
iii. To remove the records of those students whose marks are less than 30.
iv. To add a new column Grade of suitable datatype.
v. To display records of “Informatics Practices” subject.
18. Rasha creates a table STOCK to maintain computer stock in
vidyalaya. After creation of the table, she has entered data of 8 items
in the table.
Table : STOCK
154 | P a g e
iii. If three columns are added and 5 rows are deleted from the table stock, what will be
the new degree and cardinality of the above table?
iv. Write the query to Insert the following record into the table
Stockid - 201, dateofpurchase – 18-OCT-2022, name – neckphone
Make – BoAT, price – 500.
v. Decrease the price of stock by 5% whose were purchased in year 2020.
vi. Delete the record of stock which were purchased before year 2015.
key.
155 | P a g e
22. Insert the details of 5 students in the above table
23. Delete the details of a student in the above table whose marks are
less than 40.
24. Use the select command to get the details of the students with
marks more than 80.
25. Find the min, max, sum and average of the marks in a student
marks table.
26. Find the total number of customers from each country in the
table(customer id, customer name, country) using group by.
27. Write a SQL query to order the (student id, marks) table in
aescending order of the marks.
156 | P a g e