0% found this document useful (0 votes)
25 views132 pages

Informatics Practices: UNIT-2

The document outlines the syllabus for Informatics Practices for Class XII (2024-2025), covering topics such as Data Handling using Pandas, Database Query using SQL, Introduction to Computer Networks, and Societal Impacts. It includes detailed unit-wise content, learning outcomes, marks distribution, and practical exercises. Additionally, it emphasizes copyright and proprietary rights of Allen Career Institute regarding the material provided.

Uploaded by

outbox.aditi
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)
25 views132 pages

Informatics Practices: UNIT-2

The document outlines the syllabus for Informatics Practices for Class XII (2024-2025), covering topics such as Data Handling using Pandas, Database Query using SQL, Introduction to Computer Networks, and Societal Impacts. It includes detailed unit-wise content, learning outcomes, marks distribution, and practical exercises. Additionally, it emphasizes copyright and proprietary rights of Allen Career Institute regarding the material provided.

Uploaded by

outbox.aditi
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/ 132

INFORMATICS PRACTICES

S.No. Content Page


Syllabus I - IV

UNIT-1 : Data Handling using Pandas

01. Chapter-1 : Data Handling using Pandas –I 1 – 32

02. Chapter-2 : Data Visualization 33 – 52

UNIT-2 : Database Query Using SQL

03. Chapter-3 : Database Query Using SQL 53 – 70

UNIT-3 : Introduction to Computer Networks

04. Chapter-4 : Introduction to Computer Networks 71 – 86

UNIT-4 : Societal Impacts

05. Chapter-5 : Societal Impacts 87 – 98

06. CBSE SAMPLE PAPER with Solution – 2023-24 99 – 112

07. CBSE QUESTION PAPER with Solution – 2023-24 113 – 126


All rights including trademark and copyrights and rights of translation etc. reserved and vested exclusively with
Allen Career Institute Private Limited. (Allen)

No part of this work may be copied, reproduced, adapted, abridged or translated, transcribed, transmitted,
stored or distributed in any form retrieval system, computer system, photographic or other system or
transmitted in any form or by any means whether electronic, magnetic, chemical or manual, mechanical, digital,
optical, photocopying, recording or otherwise, or stood in any retrieval system of any nature without the written
permission of the Allen Career Institute Private Limited. Any breach will entail legal action and prosecution
without further notice.

This work is sold/distributed by Allen Career Institute Private Limited subject to the condition and undertaking
given by the student that all proprietary rights (under the Trademark Act, 1999 and Copyright Act, 1957) of the
work shall be exclusively belong to Allen Career Institute Private Limited. Neither the Study Materials and/or
Test Series and/or the contents nor any part thereof i.e. work shall be reproduced, modify, re-publish,
sub-license, upload on website, broadcast, post, transmit, disseminate, distribute, sell in market, stored in a
retrieval system or transmitted in any form or by any means for reproducing or making multiple copies of it.

Any person who does any unauthorised act in relation to this work may be liable to criminal prosecution and
civil claims for damages. Any violation or infringement of the propriety rights of Allen shall be punishable
under Section- 29 & 52 of the Trademark Act, 1999 and under Section- 51, 58 & 63 of the Copyright Act, 1957 and
any other Act applicable in India. All disputes are subjected to the exclusive jurisdiction of courts, tribunals and
forums at Kota, Rajasthan only.

Note:- This publication is meant for educational and learning purposes. All reasonable care and diligence have
been taken while editing and printing this publication. Allen Career Institute Private Limited shall not hold any
responsibility for any error that may have inadvertently crept in. Allen Career Institute Private Limited is not
responsible for the consequences of any action taken on the basis of this publication.
CBSE

SYLLABUS
INFORMATICS PRACTICES (CODE NO. 065)
CLASS XII (2024-2025)

1. Prerequisite: Informatics Practices – Class XI


2. Learning Outcomes
At the end of this course, students will be able to:
• Create Series, Data frames and apply various operations.
• Visualize data using relevant graphs.
• Design SQL queries using aggregate functions.
• Import/Export data between SQL database and Pandas.
• Learn terminology related to networking and internet.
• Identify internet security issues and configure browser settings.
• Understand the impact of technology on society including gender and disability issues.

3. Distribution of Marks and Periods


Unit No. Unit Name Marks
1 Data Handling using Pandas and Data Visualization 25
2 Database Query using SQL 25
3 Introduction to Computer Networks 10
4 Societal Impacts 10
Project -
Practical 30
Total 100

4. Unit Wise syllabus


Unit 1: Data Handling using Pandas -I
• Introduction to Python libraries- Pandas, Matplotlib.
• Data structures in Pandas - Series and Data Frames.
• Series: Creation of Series from – ndarray, dictionary, scalar value; mathematical operations;
Head and Tail functions; Selection, Indexing and Slicing.
• Data Frames: creation - from dictionary of Series, list of dictionaries, Text/CSV files;
display; iteration; Operations on rows and columns: add, select, delete, rename; Head and
Tail functions; Indexing using Labels, Boolean Indexing;
• Importing/Exporting Data between CSV files and Data Frames.
Data Visualization
• Purpose of plotting; drawing and saving following types of plots using Matplotlib – line plot,
bar graph, histogram
• Customizing plots: adding label, title, and legend in plots.

E I
XII CBSE / Informatics Practices

Unit 2: Database Query using SQL
• Revision of database concepts and SQL commands covered in class XI
• Math functions: POWER (), ROUND (), MOD ().
• Text functions: UCASE ()/UPPER (), LCASE ()/LOWER (), MID ()/SUBSTRING
()/SUBSTR (),
• LENGTH (), LEFT (), RIGHT (), INSTR (), LTRIM (), RTRIM (), TRIM ().
• Date Functions: NOW (), DATE (), MONTH (), MONTHNAME (), YEAR (), DAY (),
DAYNAME ().
• Aggregate Functions: MAX (), MIN (), AVG (), SUM (), COUNT (); using COUNT (*).
• Querying and manipulating data using Group by, Having, Order by.
• Working with two tables using equi-join
Unit 3: Introduction to Computer Networks
• Introduction to networks, Types of network: PAN, LAN, MAN, WAN.
• Network Devices: modem, hub, switch, repeater, router, gateway
• Network Topologies: Star, Bus, Tree, Mesh.
• Introduction to Internet, URL, WWW, and its applications- Web, email, Chat, VoIP.
• Website: Introduction, difference between a website and webpage, static vs dynamic web
page, web server and hosting of a website.
• Web Browsers: Introduction, commonly used browsers, browser settings, add-ons and plug-
ins, cookies.
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.
Project Work
 The aim of the class project is to create tangible and useful IT application. The learner
may identify a real-world problem by exploring the environment. e.g. Students can visit
shops/business places, communities or other organizations in their localities and enquire
about the functioning of the organization, and how data are generated, stored, and
managed.
 The learner can take data stored in csv or database file and analyze using Python
libraries and generate appropriate charts to visualize.
 Learners can use Python libraries of their choice to develop software for their school or
any other social good.
 Learners should be sensitized to avoid plagiarism and violation of copyright issues while
working on projects. Teachers should take necessary measures for this. Any resources
(data, image etc.) used in the project must be suitably referenced.
 The project can be done individually or in groups of 2 to 3 students. The project should
be started by students at least 6 months before the submission deadline.

II E
CBSE

Practical Marks Distribution
S. No. Unit Name Marks
1 Programs using Pandas and Matplotlib 8
2 SQL Queries 7
3 Practical file (minimum of 15 programs based on Pandas, 4 based on 5
Matplotlib and 15 SQL queries must be included)
4 Project Work (using concepts learned in class XI and XII) 5
5 Viva-Voce 5
TOTAL 30

5. Suggested Practical List


5.1 Data Handling
1. Create a panda’s series from a dictionary of values and a 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 for examination result and display row labels, column labels data types
of each column and the dimensions
5. Filter out rows based on different criteria such as duplicate rows.
6. Importing and exporting data between pandas and CSV file
5.2 Visualization
1. Given the school result data, analyses the performance of the students on different
parameters, e.g subject wise or class wise.
2. For the Data frames created above, analyze, and plot appropriate charts with title and
legend.
3. 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.
5.3 Data Management
1. Create a student table with the student id, name, and marks as attributes where the student
id is the primary key.
2. Insert the details of a new student in the above table.
3. Delete the details of a student in the above table.
4. Use the select command to get the details of the students with marks more than 80.
5. Find the min, max, sum, and average of the marks in a student marks table.
6. Find the total number of customers from each country in the table (customer ID, customer
Name, country) using group by.
7. Write a SQL query to order the (student ID, marks) table in descending order of the marks.

E III
XII CBSE / Informatics Practices

IMPORTANT NOTES

_______________________________________________________________________

_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________

IV E
CBSE

CHAPTER-1: DATA HANDLING USING PANDAS–I
Pandas:
• It is a package useful for data analysis and manipulation.
• Pandas provide an easy way to create, manipulate and wrangle the data.
• Pandas provide powerful and easy-to-use data structures, as well as the means to quickly
perform operations on these structures.
Data scientists use Pandas for its following advantages:
 Easily handles missing data.
 It uses Series for one-dimensional data structure and DataFrame for multi-dimensional data
structure.
 It provides an efficient way to slice the data.
 It provides a flexible way to merge, concatenate or reshape the data.

DATA STRUCTURE IN PANDAS


A data structure is a way to arrange the data in such a way that so it can be accessed quickly and
we can perform various operation on this data like- retrieval, deletion, modification etc.
Pandas deals with 3 data structure-
1. Series
2. Data Frame
3. Panel
We are having only series and data frame in our syllabus.

SERIES
Series-Series is a one-dimensional array like structure with homogeneous data, which can be used to
handle and manipulate data. What makes it special is its index attribute, which has incredible
functionality and is heavily mutable.
It has two parts-
1. Data part (An array of actual data)
2. Associated index with data (associated array of indexes or data labels)
e.g.-
Index Data
0 10
1 15
2 18
3 22

 We can say that Series is a labeled one-dimensional array which can hold any type of data.
 Data of Series is always mutable, means it can be changed.
 But the size of Data of Series is always immutable, means it cannot be changed.

E 1
XII CBSE / Informatics Practices

 Series may be considered as a Data Structure with two arrays out which one array works as
Index (Labels) and the second array works as original Data.
 Row Labels in Series are called Index.

Syntax to create a Series:

<Series Object>=pandas.Series (data, index=idx (optional))

 Where data may be python sequence (Lists), ndarray, scalar value or a python dictionary.

How to create Series with nd array

Program-
import pandas as pd Output-
import numpy as np Default Index Data
arr=np.array([10,15,18,22]) 0 10
↓ 1 15
Here we create an array of 4 values. 2 18
s = pd.Series(arr) 3 22
print(s)

How to create Series with Mutable index


Program-
import pandas as pd Output-
import numpy as np first a
arr=np.array(['a','b','c','d']) second b
s=pd.Series(arr, third c
index=['first','second','third','fourth']) fourth d
print(s)

Creating a series from Scalar value


To create a series from scalar value, an index must be provided. The scalar value will be repeated as
per the length of index.

2 E
CBSE

Creating a series from a Dictionary

Mathematical Operations in Series

Print all the values of the Series by multiplying them by 2.

Print Square of all the values of the

Print all the values of the Series that are greater than 2.

E 3
XII CBSE / Informatics Practices

Example-2

While adding two series, if Non-Matching Index is found in either of the


Series, Then NaN will be printed corresponds to Non-Matching Index.

If Non-Matching Index is found in either of the series, then this Non-


Matching Index corresponding value of that series will be filled as 0.

4 E
CBSE

Head and Tail Functions in Series
head (): It is used to access the first 5 rows of a series.
Note :To access first 3 rows we can call series_name.head(3):

Result of s.head()

Result of s.head(3)

tail(): It is used to access the last 5 rows of a series.


Note :To access last 4 rows we can call series_name.tail (4)

E 5
XII CBSE / Informatics Practices

Selection in Series
Series provides index label loc and ilocand [] to access rows and columns.
1. loc index label :-
Syntax:-series_name.loc[StartRange: StopRange]
Example-

To Print Values from Index 0 to 2

To Print Values from Index 3 to 4

6 E
CBSE

2. Selection Using iloc index label :-
Syntax:-series_name.iloc[StartRange : StopRange]
Example-

To Print Values from Index 0 to 1.

3. Selection Using [] :
Syntax:-series_name[StartRange> : StopRange] or
series_name[ index]
Example-

To Print Values at Index 3.

E 7
XII CBSE / Informatics Practices

Indexing in Series
Pandas provide index attribute to get or set the index of entries or values in series.
Example-

Slicing in Series
Slicing is a way to retrieve subsets of data from a pandas object. A slice object syntax is –
SERIES_NAME [start:end: step]
The segments start representing the first item, end representing the last item, and step representing the
increment between each item that you would like.
Example :-

8 E
CBSE

DATAFRAME
DATAFRAME-It is a two-dimensional object that is useful in representing data in the form of rows
and columns. It is similar to a spreadsheet or an SQL table. This is the most commonly used pandas
object. Once we store the data into the Dataframe, we can perform various operations that are useful in
analyzing and understanding the data.
DATAFRAME STRUCTURE

COLUMNS→ PLAYERNAME IPLTEAM BASEPRICEINCR

0 ROHIT MI 13
1 VIRAT RCB 17
2 HARDIK MI 14

INDEX DATA

PROPERTIES OF DATAFRAME
1. A Dataframe has axes (indices)-
➢ Row index (axis=0)
➢ Column index (axes=1)
2. It is similar to a spreadsheet , whose row index is called index and column index is called column
name.

3. A Dataframe contains Heterogeneous data.


4. A Dataframe Size is Mutable.
5. A Dataframe Data is Mutable.

A data frame can be created using any of the following-


1. Series
2. Lists
3. Dictionary
4. A numpy 2D array

How to create Empty Dataframe

E 9
XII CBSE / Informatics Practices

How to create Dataframe From Series
Program-
Output-
import pandas as pd
0 (Default Column Name As O)
s = pd.Series(['a','b','c','d'])
0 a
df=pd.DataFrame(s)
1 b
print(df) 2 c
3 d

DataFrame from Dictionary of Series


Example-

DataFrame from List of Dictionaries


Example-

Iteration on Rows and Columns


If we want to access record or data from a data frame row wise or column wise then iteration is used.
Pandas provide 2 functions to perform iterations-
1. iterrows ()
2. iteritems ()

iterrows()
It is used to access the data row wise. Example-

10 E
CBSE


iteritems()
It is used to access the data column wise.
Example-

E 11
XII CBSE / Informatics Practices

Select operation in data frame

To access the column data ,we can mention the column name as subscript.
e.g. - df[empid] This can also be done by using df.empid.
To access multiple columns we can write as df[ [col1, col2,---] ]
Example –

>>df.empid or df[‘empid’]
0 101
1 102
2 103
3 104
4 105
5 106
Name: empid, dtype: int64
>>df[[‘empid’,’ename’]]
empid ename
0 101 Sachin
1 102 Vinod
2 103 Lakhbir
3 104 Anil
4 105 Devinder
5 106 UmaSelvi

12 E
CBSE

To Add & Rename a column in data frame
import pandas as pd
s = pd.Series([10,15,18,22])
df=pd.DataFrame(s)
df.columns=[‘List1’] → To Rename the default column of Data Frame as List1
df[‘List2’]=20 → To create a new column List2 with all values as 20

df[‘List3’]=df[‘List1’]+df[‘List2’] Output-
↓ List1 List2 List3
Add Column1 and Column2 and store in 0 10 20 30
New column List3 1 15 20 35
print(df) 2 18 20 38
3 22 20 42

To Delete a Column in data frame


We can delete the column from a data frame by using any of the the following –
1. del
2. pop()
3. drop()

>>del df[‘List3’]→ We can simply delete a column by passing column name in subscript with df
>>df
Output-
List1 List2
0 10 20
1 15 20
2 18 20
3 22 20
>>df.pop(‘List2’) → we can simply delete a column by passing column name in pop method.
>>df
List1
0 10
1 15
2 18
3 22
To Delete a Column Using drop()
import pandas as pd
s=pd.Series([10,20,30,40])
df=pd.DataFrame(s)
df.columns=[‘List1’]
df[‘List2’]=40
df1=df.drop(‘List2’,axis=1) → (axis=1) means to delete Data column wise

E 13
XII CBSE / Informatics Practices

df2=df.drop(index=[2,3],axis=0)→ (axis=0) means to delete data row wise with given index
print(df)
print(“ After deletion::”)
print(df1)
print (“ After row deletion::”)
print(df2)
Output-
List1 List2
0 10 40
1 20 40
2 30 40
3 40 40
After deletion::
List1
0 10
1 20
2 30
3 40
After row deletion::
List1
0 10
1 20

Accessing the data frame through loc() and iloc() method or indexing using Labels
Pandas provide loc() and iloc() methods to access the subset from a data frame using row/column.

Accessing the data frame through loc()


It is used to access a group of rows and columns.
Syntax-
Df.loc[StartRow : EndRow, StartColumn : EndColumn]
Note -If we pass : in row or column part then pandas provide the entire rows or columns respectively.

14 E
CBSE


Example 2:-

E 15
XII CBSE / Informatics Practices

Example 3:-

Accessing the data frame through iloc()


It is used to access a group of rows and columns based on numeric index value.

Syntax-

Df.loc[StartRowindexs : EndRowindex StartColumnindex : EndColumnindex]

Note -If we pass : in row or column part then pandas provide the entire rows or columns respectively.

16 E
CBSE


head() and tail() Method


The method head() gives the first 5 rows and the method tail() returns the last 5 rows.
import pandas as pd
empdata={'Doj':['12-01-2012','15-01-2012','05-09-2007',
'17-01-2012','05-09-2007','16-01-2012'],
'empid':[101,102,103,104,105,106],
'ename':['Sachin','Vinod','Lakhbir','Anil','Devinder','UmaSelvi']
}
df=pd.DataFrame(empdata)
print(df)
print(df.head())
print(df.tail())
Output-
Doj empid ename
0 12-01-2012 101 Sachin
1 15-01-2012 102 Vinod
2 05-09-2007 103 Lakhbir → Data Frame
3 17-01-2012 104 Anil
4 05-09-2007 105 Devinder
5 16-01-2012 106 UmaSelvi

E 17
XII CBSE / Informatics Practices

Doj empid ename
0 12-01-2012 101 Sachin
1 15-01-2012 102 Vinod → head() displays first 5 rows
2 05-09-2007 103 Lakhbir
3 17-01-2012 104 Anil
4 05-09-2007 105 Devinder
Doj empid ename
1 15-01-2012 102 Vinod
2 05-09-2007 103 Lakhbir
3 17-01-2012 104 Anil → tail() display last 5 rows
4 05-09-2007 105 Devinder
5 16-01-2012 106 UmaSelvi

To display first 2 rows we can use head(2) and to returns last2 rows we can use tail(2) and to return 3rd
to 4th row we can write df[2:5].
import pandas as pd
empdata={ 'Doj':['12-01-2012','15-01-2012','05-09-2007',
'17-01-2012','05-09-2007','16-01-2012'],
'empid':[101,102,103,104,105,106],
'ename':['Sachin','Vinod','Lakhbir','Anil','Devinder','UmaSelvi']
}
df=pd.DataFrame(empdata)
print(df)
print(df.head(2))
print(df.tail(2))
print(df[2:5])
Output-
Doj empid ename
0 12-01-2012 101 Sachin
1 15-01-2012 102 Vinod
2 05-09-2007 103 Lakhbir
3 17-01- 2012 104 Anil
4 05-09-2007 105 Devinder
5 16-01-2012 106 UmaSelvi
Doj empid ename
0 12-01-2012 101 Sachin → head(2) displays first 2 rows
1 15-01-2012 102 Vinod
Doj empid ename
4 05-09-2007 105 Devinder → tail(2) displays last 2 rows
5 16-01-2012 106 UmaSelvi
Doj empid ename
2 05-09-2007 103 Lakhbir
3 17-01- 2012 104 Anil → df[2:5] display 2nd to 4th row
4 05-09-2007 105 Devinder

18 E
CBSE

Boolean Indexing in Data Frame
Boolean indexing helps us to select the data from the DataFrames using a boolean vector. We create a
DataFrame with a boolean index to use the boolean indexing.

Concat operation in data frame


Pandas provides various facilities for easily combining together Series, DataFrame.

pd.concat(objs, axis=0, join='outer', join_axes=None,ignore_index=False)


• objs − This is a sequence or mapping of Series, DataFrame, or Panel objects.
• axis − {0, 1, ...}, default 0. This is the axis to concatenate along.
• join − {‘inner’, ‘outer’}, default ‘outer’. How to handle indexes on other axis(es). Outer for
union and inner for intersection.
• ignore_index − boolean, default False. If True, do not use the index values on the
concatenation axis. The resulting axis will be labeled 0, ..., n - 1.
• join_axes − This is the list of Index objects. Specific indexes to use for the other (n-1) axes
instead of performing inner/outer set logic.

The Concat() performs concatenation operations along an axis.

E 19
XII CBSE / Informatics Practices

Example-1

Example-2

20 E
CBSE

Example-3

Example-4

Merge operation in data frame


Two DataFrames might hold different kinds of information about the same entity and linked by some
common feature/column. To join these DataFrames, pandas provides multiple functions like merge(),
join() etc.

E 21
XII CBSE / Informatics Practices

Example-1

Example-2

22 E
CBSE

Join operation in data frame
It is used to merge data frames based on some common column/key.

1. Full Outer Join:- The full outer join combines the results of both the left and the right outer
joins. The joined data frame will contain all records from both the data frames and fill in NaNs
for missing matches on either side. You can perform a full outer join by specifying the how
argument as outer in merge() function.

Example-1

E 23
XII CBSE / Informatics Practices

Example-2

2. Inner Join :- The inner join produce only those records that match in both the data frame. You
have to pass inner in how argument inside merge() function.

Example-

24 E
CBSE

3. RightJoin : The right join produce a complete set of records from data frame B(Right side Data
Frame) with the matching records (where available) in data frame A( Left side data frame). If
there is no match right side will contain null. You have to pass right in how argument inside
merge() function.
Example-

4. Left Join :- The left join produce a complete set of records from data frame A(Left side Data
Frame) with the matching records (where available) in data frame B( Right side data frame). If
there is no match left side will contain null. You have to pass left in how argument inside merge()
function.
Example-

E 25
XII CBSE / Informatics Practices

5. Joining on Index :-Sometimes you have to perform the join on the indexes or the row labels. For
that you have to specify right_index( for the indexes of the right data frame ) and left_index( for
the indexes of left data frame) as True.
Example-

CSV File
A CSV is a comma separated values file, which allows data to be saved in a tabular format. CSV
is a simple file such as a spreadsheet or database. Files in the csv format can be imported and
exported from programs that store data in tables, such as Microsoft excel or Open Office.
CSV files data fields are most often separated, or delimited by a comma. Here the data in each
row are delimited by comma and individual rows are separated by newline.
To create a csv file, first choose your favorite text editor such as- Notepad and open a new file.
Then enter the text data you want the file to contain, separating each value with a comma and
each row with a new line. Save the file with the extension.csv. You can open the file using MS
Excel or another spread sheet program. It will create the table of similar data.

26 E
CBSE

pd.read_csv() method is used to read a csv file.

Exporting data from dataframe to CSV File


To export a data frame into a csv file first of all, we create a data frame say df1 and use
dataframe.to_csv(‘ E:\Dataframe1.csv ’ ) method to export data frame df1 into csv file
Dataframe1.csv.

And now the content of df1 is exported to csv file Dataframe1.

E 27
XII CBSE / Informatics Practices

(A) MULTIPLE CHOICE QUESTIONS
Q.1 Which of the following statement is wrong?
(1) Can't change the index of the Series.
(2) We can easily convert the list, tuple, and dictionary into a series.
(3) A Series represents a single column in memory.
(4) We can create empty Series
Ans. (1)
Q.2 Which python library is not used for data sciece?
(1) Pandas (2) Numpy (3) Matplotlib (3) Tkinter
Ans. (4)
Q.3 Python Pandas was developed by:
(1) Guido van Rossum (2) Travis Oliphant
(3) Wes McKinney (4) Brendan Eich
Ans. (3)
Q.4 The name "Pandas" is derived from the term:
(1) Panel Data (2) Panel Series
(3) Python Document (4) Panel Data Frame
Ans. (1)
Q.5 Pandas Series is:
(1) 2 Dimensional (2) 3 Dimensional (3) 1 Dimensional (4) Multi-Dimensional
Ans. (3)

(B) NCERT BASED QUESTIONS


Very Short Answer Type Questions
Q.1 To specify datatype int16 for a Series object, you can write :
Ans. pd.Series(data = array, dtype = numpy.int16)
Q.2 Define add() function in series.
Ans. add() function is used to add series and others, elements wise.
Q.3 What is the use of tail() functions?
Ans. tail() functions returns last n rows from the object based on position. It is useful for quickly
verifying data.
Q.4 Consider the following code and predict the output
import pandas as pd
s1=pd. Series(range(1,9,2),index=list('abce')) print(s1[::])
Ans. a 1
c 5

28 E
CBSE

Q.5 Given the following series S1 and S2:
What will be the output of following statement?
print (S1+S2)
S1 S2
A 10 A 80
B 40 B 20
C 34 C 74
D 60 D 90
Ans. A 90
B 60
C 108
D 150

(C) CASE BASED QUESTIONS


I. Consider the following information and answer any four questions that follows:
Pandas Series is a one dimensional labelled array capable of holding data of any type (integer,
string, float, python objects, etc.) The axis labels are collectively called index. Pandas Series is
nothing but a column in an excel sheet.
Labels need not be unique but must be a hashable type. The object supports both integer
and label:
based indexing and provides a host of methods for performing operations involving the index.
Q.1 Which type of data does Series hold?
Ans. Series hold data of any type i.e. integer, string, float, python objects, etc.
Q.2 Name any two inputs with which series can be created.
Ans. Array, Dict
Q.3 Give the syntax to create empty series.
Ans. pandas.Series()
Q.4 What is index in Series?
Ans. The row labels of series are called the index.
Q.5 How can you access an element in a series?
Ans. Use the index operator [ ] to access an element in a series.

(D) TRUE OR FALSE


Q.1 Pandas is a Library.
Ans. True
Q.2 Pandas is an open-source Python Libeary.
Ans. True
Q.3 Pandas is built on the Numpy package and its key data structure is called the DataFrame.
Ans. True
Q.4 Data structures in Pandas can be mutated in the terms of semantic but not not of value.
Ans. False
Q.5 In pandas, Index values must be unique and hashable.
Ans. True

E 29
XII CBSE / Informatics Practices

(E) FILL IN THE BLANKS
Q.1 Data structures in Pandas can be mutated in the terms of _______ but not of ________.
(1) size, value (2) value, size (3) semantic, size (4) none of the above
Ans. (2)
Q.2 _________ function is used to create a data series.
(1) Series() (2) DataSeries() (3) DS() (4) None
Ans. (1)
Q.3 Given a Pandas series called sequences, the command which will display the first 4 rows is ___.
(1) print (squences.head(4)) (2) print (sequences.Head(4))
(3) print (sequences.heads(4)) (4) print (sequences.Heads(4))
Ans. (1)
Q.4 Series data is ______ but the size of Series data is ________.
(1) Immutable, mutable (2) Mutable, immutable
(3) Mutable, mutable (4) Immutable, immutable
Ans. (B)
Q.5 By default df.head() will display ________ rows from the top.
(1) 2 (2) 3 (3) 5 (4) 4
Ans. (3)

(F) ASSERTION AND REASON


Direction: In the following questions, a statement of assertion (A) is following by a statement of
reason (R), Mark the correct choice as:
Q.1 Assertion (A): You need to import or load the Pandas library first in order to use it.
Reason (R): The "pd" is an alias or abbreviation which will be used as a shortcut to access or
call pandas functions.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (2)
Q.2 Assertion (A): In Python Pandas, Series. Index attribute is used to get or set the index labels of
the given series object.
Reason (R): ix[] attribute is used to access a group of rows and columns by label (s) or a
Boolean array in the given series object.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (3)

30 E
CBSE

Q.3 Assertion (A): In series, Series.selection() function is used for selection.
Reason (R): tail() function returns last n rows from the object based on position. It is useful for
quickly verifying data.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (4)
Q.4 Assertion (A): A dict can be passed as an input to the Series.
Reason (R): If index is passed, then corresponding values to a particular label in the index will
be extracted from the dictionary.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (2)

Q.5 Assertion (A): add() function is used to add series and others, element wise.
Reason (R): Parameter of add(), fill_value has default value None.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (1)

E 31
XII CBSE / Informatics Practices

IMPORTANT NOTES

_______________________________________________________________________

_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________

_______________________________________________________________________

_______________________________________________________________________

32 E
CBSE

CHAPTER-2 : DATA VISUALIZATION
When data is shown in the form of pictures, it becomes easy for the user to understand it. So
representing the data in the form of pictures or graph is called "data visualization". It represents
(patterns, trends, correlations etc.) in data and thereby helps decision makers to understand the meaning
of data for making decision in business.
• Matplotlib is a python library which provides many interfaces and function to present data in
2D graphics. we can say, Matplotlib is a high quality plotting library of Python.
• Matplotlib library offers many different collections of sub modules; Pyplot is one such sub
module.
• Pyplot is a collection of methods within Matplotlib library which allows user to construct 2D
plots easily.

Installing and importing Matplotlib-


With Anaconda : if we have installed python using Anaconda, then Matplotlib is already installed on
your computer. We can check this Anaconda Navigator, by Clicking on Environment and then scroll
down to find Matplotlib.

With Standard Installation : First we need to download wheel package of Matplotlib as per Python's
version installed and platform (OS).

With Standard Installation : Next we need to install it by giving following command:


python –m pip install –U pip
python –m pip install –U matplotlib
To use Pyplot for data visualization, we have to first import it in our python environment.
import matplotlib.pyplot
But this method will require to type every command as –
matplotlib.pyplot.Command

E 33
XII CBSE / Informatics Practices

Another method is-
import matplotlib.pyplot as plt
(Now we can qualify command as plt. Command)
(plt is just identifier we can take any name)

Basics of Simple Plotting


• There are various types of chart we can use to visualize the data elements like.
• Line Chart: it displays Information as a series of data points called 'markers' connected by
straight line.
• Bar Chart: it present category wise data in rectangular bars with length proportional to the
values. It can be horizontal and vertical.
• Pie Chart: Is a circular chart divided into slices to represent the value/percentage.

Line Chart or Line Graph


Line graph is a simple graph that shows the result in the form of lines. To create a line graph we need x
and y coordinates.
For example-
pit.plot(x, t,', 'colorname")
plot() function is used to draw line chart. In previous examples we already observed this. Let us draw
and use various attributes available with plot().

34 E
CBSE


Program:

Output:

E 35
XII CBSE / Informatics Practices

Changing line color and line width and line style :

Changing Market Type, Size and Color

36 E
CBSE


Bar Graph

E 37
XII CBSE / Informatics Practices

Changing Width, Color in Bar Chart :

Example 2-

38 E
CBSE


Horizontal Bar Graph:


barh() is used to draw horizontal bar graph.

Output-

E 39
XII CBSE / Informatics Practices

Multiple Bar Graph :

To draw multiple bar chart:


• Decide the no. of X points, we can use arrange() or linspace() function to find no. of points
based on the length of values in sequence.
• Decide the thickness of each bar and accordingly adjust X point on X-axis
• Give different color to different data ranges
• The width remains the same for all ranges being plotted
• Call plot() for each data range

Anatomy of chart :-

40 E
CBSE

Setting Limits and Ticks

Pie Chart
A pie chart shows a circle that is divided into sector and each sector represents a proportion of the
whole.

• Sometime we want to emphasize on one or more slice and show them little pulled out. This feature
is called explode in pie chart.
• If we want to explode or stand out 2nd and 3rd slice out of 5 slices to 0.2 and 0.3 unit respectively,
explode will be [0,0.2,0.3,0,0]. The value of explode vary from 0.1 to 1to show that how much a
slice will come out of pie chart.
autopct : allows to view percentage of share in a pie chart-
The option autopct='%.1f %%' indicates how to display the percentages on the slices. Here %.1
shows that the percentage value should be displayed with 1 digit after decimal point. The next two
% symbols indicates that only one symbol is to be displayed.

E 41
XII CBSE / Informatics Practices

Shadow option-
Shadow= True indicates that the pie chart should be displayed with a shadow. This will improve
the look of the chart.

Setting ticks of Bar Graph :-

42 E
CBSE

Histogram
Histogram shows distribution of values. Histogram is similar to bar graph but it is useful to show
values grouped in bins or intervals. For example- we can collect the age of each employee in an office
and show it in the form of a histogram to know how many employees are there in the range 0-10 years,
10-20 years and so on. For this we can create histogram like this-

Example 2-

E 43
XII CBSE / Informatics Practices

Output-

Note- edgecolor is used to define the color of edge around bar.

Frequency Polygons
Frequency polygon is a way for understanding the shape of distributions. It connects the top center
point of each bins and then we get the relative frequency polygon. It has the same purpose as the
histogram have but is used specially for comparing sets of data.

Output-

histtype='step' creates frequency polygon by using hist().

44 E
CBSE

Box Plot
A Box plot is graphical representation of the five number summary of given data set. It includes
1. Maximum
2. 2. Minimum
3. 1" Quartile
4. 2ND Quartile (Median)
5. 3RD Quartile

Example 1-

E 45
XII CBSE / Informatics Practices


More about Box Plot :


IQR (Inter Quartile Range) = It always lies between 25th to 75th percentile. i.e. (Q3 – Q1)
Minimum = (Q1 – 1.5 * IQR)
Maximum = (Q3 + 1.5 * IQR)

46 E
CBSE

Scatter Chart
A scatter plot is a type of plot that shows the data as a collection of points in the form of dots, and
shows the relationship between two variables – one plotted along the x-axis and the other plotted along
y-axis.

Syntax-
Scatter(x, y, color, marker)
Marker- is a symbol (style) for representing data point. Following is a list of valid marker style-

Marker Description
's' Square Marker
'o' Circle Marker
'd' Diamond Marker
'x' Cross Marker
'+' Plus Marker
'∧' Triangle down
'∨' Triangle Up

Example 1-

E 47
XII CBSE / Informatics Practices

Example 2-

Saving Plots or Chartsor graph to file

(A)

48 E
CBSE

MULTIPLE CHOICE QUESTIONS
Q.1 To change the width of bars in a bar chart, which of the following arguments with a float value
is used?
(1) hwidth (2) width
(3) breath (3) barwidth
Ans. (2)
Q.2 Which command is used to show a chart?
(1) chartshow() (2) show()
(3) display() (4) showchart()
Ans. (2)
Q.3 Which function is used to create a histogram?
(1) histogram() (2) histo() (3) hist() (4) histtype
Ans. (3)
Q.4 The best type of graph to represent distribution of elements is:
(1) bar (2) histogram
(3) pie (4) basemap
Ans. (2)
Q.5 Out of the following, which function cannot be used for customization of charts in Python?
(1) xlabel() (2) colour() (3) title() (4) xticks()
Ans. (2)

(B) NCERT BASED QUESTIONS


Very Short Answer Type Questions
Q.1 Write the command to install matplotlib.
Ans. pip install matplotlib.
Q.2 In matplotlib, what is ticks ?
Ans. A standard graph shows the marks on the axis, in matplotlib library, it is called ticks.
Q.3 Define the term figure used in matplotlib.
Ans. Figure is a diagram or a shape that can be formed by a collection of plots in different
dimensions.
Q.4 What are some of the major components of any graphs or plot?
Ans. The various components of a plot are: Title,, Legend, Ticks, xlabel, ylabel, etc.
Q.5 Name the function which is used to save the plot.
Ans. Matplotlib plots can be saved as image files using the plt.savefig() function.

E 49
XII CBSE / Informatics Practices

(C) CASE BASED QUESTIONS
I. A Shivalik restaurant has recorded the following data into their register for their income by
Drinks and Food.
Day Monday Tuesday Wednesday Thursday Friday
Drinks 450 560 400 605 580
Food 490 600 425 610 625

A software designer is trying to write a code to plot the graph. Help him to fill in the blanks of
the code and get the desired output.
import matplotlib.pyplot as pp
day =['Monday', 'Tuesday','Wednesday','Thursday','Friday']
dr = [450,560,400,605,580]
fd = [490,600,425,610,625]
pp.plot(day,dr,label='Drinks',_________='g') Line-1
pp.plot(day,fd,label='Food',_______='m') Line-2
pp._____________________________ Line-3
pp._______("Orders") Line-4
pp._______ Line-5
Q.1 Identify the suitable code to be used in the blank space in line marked as Line-3 to write a title
for the chart "The Weekly Restaurant Orders".
(1) pp.title(The Weekly Restaurant Orders)
(2) pp.title("The Weekly Restaurant Orders")
(3) pp.xtitle("The Weekly Restaurant Orders")
(4) pp.ytitle(The Weekly Restaurant Orders)
Ans. (2)
Q.2 What is the name of the function to Display legends in line marked as Line-5?
(1) show() (2) showlegend() (3) legend() (4) display
Ans. (3)
Q.3 What is the name of the attribute to display your choice of colours for both the lines drinks and
food in line marked as Line-1 and 2?
(1) colors (2) style (3) xcolour (4) ycolour
Ans. (1)
Q.4 Choose the right function/method from the following for the Line-6.
(1) display (2) print () (3) bar () (4) show ()
Ans. (4)
Q.5 Choose the correct function from the following option for the Line-4.
(1) title("Orders") (2) ytitle("Orders") (3) ylabel("Orders") (4) yaxis("Orders")
Ans. (3)

50 E
CBSE

(D) TRUE OR FALSE
Q.1 plot() is used to create bar chart.
Ans. False
Q.2 Data Visualization makes complex data more accessible understandable, and usable.
Ans. True
Q.3 Using Python Matplotlib lineplot can be used to count how many values fall into each interval.
Ans. False
Q.4 The command used to save a plotted graph using pyplot functions is plt.savefig().
Ans. True
Q.5 The command used to show legends is legend().
Ans. True

(E) FILL IN THE BLANKS


Q.1 _______ is used for 2D plots in Python.
(1) pandas (2) thinter (3) math (4) matplotlib
Ans. (4)
Q.2 The _______ is a bounding box with ticks and labels.
(1) chart (2) figure (3) axes (4) application
Ans. (3)
Q.3 _________ option displays special information about the chart.
(1) QR code() (2) info() (3) legend() (4) hist()
Ans. (3)
Q.4 PyPlot is an interface of Python's _________ library.
(1) seaborn (2) plotly (3) ggplot (4) matplotlib
Ans. (4)
Q.5 Matplotlib was originally written by __________.
(1) Travis Oliphant (2) Guido van Rossum (3) John D. Hunter (4) Jim Hugunin
Ans. (3)

(F) ASSERTION AND REASON


Direction: In the following questions, a statement of assertion (A) is following by a statement of
reason (R), Mark the correct choice as:
Q.1 Assertion (A): A pie chart is a specific way of representing data using rectangular bars.
Reason (R): The default True means each hist will be filled with colour and False means each
hist will be empty.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (4)

E 51
XII CBSE / Informatics Practices

Q.2 Assertion (A): A bar graph shows comparisons among discrete categories.
Reason (R): One axis of the chart shows the specific categories being compared.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (1)
Q.3 Assertion (A): A histogram is an accurate representation of the distribution of numerical data.
Reason (R): Histogram is a kind of bar graph.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (2)
Q.4 Assertion (A): Line chart can be plotted by using (x, y) method.
Reason (R): Labels show what the chart is about.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (2)
Q.5 Assertion (A): A legend is an area describing the elements of the graph.
Reason (R): In the matplotlib library, there's a function called leg() which is used to Place a
legend on the axes.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (3)

52 E
CBSE

CHAPTER-3 : DATABASE QUERY USING SQL
Lets do practical on DATABASE…

SORTING OUTPUT
By default records will come in the output in the same order in which it was entered. To see the output
rows in sorted or arranged in ascending or descending order SQL provid ORDER BY clause. By
default output will be ascending order(ASC) to see output in descending order we use DESC clause
with ORDER BY.
Select* from emp order by name;(ascending order)
Seect* from emp order by salary desc;
Select* from emp order by dept asc, salary desc;

AGGREGATE functions
Aggregate function is used to perform calculation on group of rows and return the calculated summary
like sum of salary like sum of salary, average of salary etc.
Available aggregate functions are –
1. SUM()
2. AVG()
3. COUNT()
4. MAX()
5. MIN()
6. COUNT(*)

AGGREGATE functions
Emp.no. Name Dept. Salary
1 Ravi Sales 24000
2 Sunny Sales 35000
3 Shobit IT 30000
4 Vikram IT 27000
5 nitin HR 45000

Select SUM(salary) from emp;


Output – 161000
Select SUM(salary) from emp where dept='sales';
Output – 59000

E 53
XII CBSE / Informatics Practices

AGGREGATE functions
Emp.no. Name Dept. Salary
1 Ravi Sales 24000
2 Sunny Sales 35000
3 Shobit IT 30000
4 Vikram IT 27000
5 nitin HR 45000

Select SVG(salary) from emp;


Output – 32200
Select AVG(salary) from emp where dept='sales';
Output – 29500

AGGREGATE functions
Emp.no. Name Dept. Salary
1 Ravi Sales 24000
2 Sunny Sales 35000
3 Shobit IT 30000
4 Vikram IT 27000
5 nitin HR 45000

Select COUNT(name) from emp;


Output – 5
Select COUNT(salary) from emp where dept='HR';
Output – 1
Select COUNT(DISTINCT dept) from emp;
Output – 3

AGGREGATE functions
Emp.no. Name Dept. Salary
1 Ravi Sales 24000
2 Sunny Sales 35000
3 Shobit IT 30000
4 Vikram IT 27000
5 nitin HR 45000

Select MAX(Salary) from emp;


Output – 45000
Select MAX(salary) from emp where dept='Sales';
Output – 35000

54 E
CBSE

AGGREGATE functions
Emp.no. Name Dept. Salary
1 Ravi Sales 24000
2 Sunny Sales 35000
3 Shobit IT 30000
4 Vikram IT 27000
5 nitin HR 45000

Select MIN(Salary) from emp;


Output – 24000
Select MIN(salary) from emp where dept='IT';
Output – 27000

AGGREGATE functions
Emp.no. Name Dept. Salary
1 Ravi Sales 24000
2 Sunny Sales 35000
3 Shobit IT 30000
4 Vikram IT 27000
5 nitin HR 45000
6 Krish HR

Select COUNT(*) from emp;


Output – 6
Select COUNT(salary) from emp;
Output – 5

count(*) Vs count()
Count(*) function is used to count the number of rows in query output whereas count() is used to count
values present in any column excluding NULL values.
Note:
All aggregate function ignores the NULL values.

E 55
XII CBSE / Informatics Practices

GROUP BY
GROUP BY clause is used to divide the table into logical groups and we can perform aggregate
functions in those groups, In this case aggregate function will return output for each group. For
example if we want sum of salary of each department we have to divide table records.
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
Aggregate functions by default takes the entire table as a single group that's why we are getting the
sum(), avg(), etc output for the entire table. Now suppose organization wants the sum() of all the job
separately, or wants to find the average salary of every job. In this case we have to logically divide our
table into groups based on job, so that every group will be passed to aggregate function for calculation
and aggregate function will return the result for every group.

Group by clause helps up to divide the table into logical groups based on any column value. In those
logically divided records we can apply aggregate functions. For. E.g.

SELECT SUM(SAL) FROM EMP GROUP BY DEPT;


SELECT JOB,SUM(SAL) FROM EMP GROUP BY
DEPT;
SELECT JOB, SUM(SAL),AVG(SAL),MAX(SAL),COUNT(*) EMPLOYEE_COUNT FROM
EMP;

NOTE :- when we are suing GROUP BY we can use only aggregate function and the column on which
we are grouping in the SELECT list because they will form a group other than any column will gives
you an error because they will be not the part of the group.
SELECT ENAME, JOB, SUM(SAL) FROM EMP GROUP BY JOB;
Error → because Ename is not a group expression

56 E
CBSE

HAVING with GROUP BY
• If we want to filter or restrict some rows from the output produced by GROUP BY then we use
HAVING clause. It is used to put condition of group of rows. With having clause we can use
aggregate functions also.
• WHERE is used before the GROUP BY. With WHERE we cannot use aggregate function.
• E.g.
• SELECT DEPT,AVG(SAL) FROM EMP GROUP BY DEPT HAVING JOB IN ('HR','SALES')
• SELECT DEPT,MAX(SAL),MIN(SAL),COUNT(*) FROM EMP GROUP BY DEPT HAVING
COUNT(*)>2
• SELECT DEPT,MAX(SAL),MIN(SAL) FROM EMP WHERE SAL>=2000 GROUP BY DEPT
HAVING DEPT IN('IT','HR')

MYSQL FUNCTIONS
A function is built – in code for specific purpose that takes value and returns a single value, Values
passed to functions are known as arguments/parameters.
There are various categories of function in MySQL:-
1) String Function
2) Mathematical function
3) Date and time function

String Function

Function Description Example


CHAR() Return character for given Select Char(65); Output- A
ASCII Code
CONCAT() Return concatenated string Select concat(name, 'works in', 'dept', 'department');
LOWER() Return string in small Select lower('INDIA'); Output- india Select
/LCASE() letters lower(name) from emp;
SUBSTRIN Return N character of Select SUBSTRING('LAPTOP',3,3); Output – PTO–
G(S,p,N)/ string S, beginning from P Select SUBSTR('COMPUTER',4,3); Output – PUT
MID(S,p,N)
UPPER() Return string in capital Select Upper('india'); Output- INDAI
/UCASE() letters
LTRIM() Removes leading space Select LTRIM('Apple'); Output- 'Apple'
RTRIM Remove trailing space Select RTRIM('Apple'); Output-'Apple'

E 57
XII CBSE / Informatics Practices

String Function

Function Description Example


TRIME() Remove spaces from Select TRIM('Apple'); Output-'Apple'
beginning and ending Select * from emp where trim(name) = 'Suyash';
INSTR() It search one string in Select INSTR('COMPUTER','PUT'); Output-4
another string and returns Select INSTR('PYTHON','C++'); Output – 0
position, if not found 0
LENGTH() Returns number of Select length('python'); Output- 7
character in string Select name, length(name) from emp
LEFT(S,N) Return N characters of S Select LEFT('KV NO1 TEZPUR',2); Output – KV
from beginning
RIGHT(S,N) Return N characters of S Select RIGHT('KV NO1',3); Output- NO1
from ending

Numeric Function

Function Description Example


MOD(M,N) Remove remainder Select MOD(11,5); Output-1
M/N
POWER(B,P) Return B to power P Select POWER(2,5); Output-32
ROUND(N,D) Return number Select ROUND(11,589,2); Output- 11.59
rounded to D place Select ROUND(12,999,2); Output- 13.00
after decimal Select ROUND(267,478,-2); OUTPUT- 300
SIGN(N) Return -1 for –ve Select sign(-10) Output : -1
number 1 for +ve Select sign(10); Output : 1
number
SQRT(N) Returns square root Select SQRT(144); Output- 12
of N
TRUNCATE(M,N) Return number upto Select Truncate(15.789,2); Output: 15.79
N place after decimal
without rounding it

58 E
CBSE

Date and Time Function

Function Description Example


CURDATE()/ Return the current date Select curdate(); Select current_date();
CURRENT_DATE()/
CURRENT_DATE
DATE() Return date part from date-time Select date('2018-08-15 12:30');
expression Output: 2018-08-15
MONTH() Return month from date Select month('2018-08-15'); Output: 08
YEAR() Return year from date Select year('2018-08-15'); Output: 2018
DAYNAME() Return weekday name Select dayname('2018-12-04');
Output: Tuesday
DAYOFMONTH() Return value from 1-31 Select dayofmonth('2018-08-15')
Output: 15
DAYOFWEEK() Return weekday index, for Select dayofweek('2018-12-04');
Sunday-1, Monday-2, .. Output: 3
DAYOFYEAR() Return value from 1-366 Select dayofyear('2018-02-10')
Output: 41
NOW() Returns both current date and Select now();
time at which the function
executes
SYSDATE() Return both current date and Select sysdate()
time
Difference Between NOW() and SYSDATE() :
NOW() function return the date and time at which function was executed even if we execute multiple
NOW() function with select. whereas SYSDATE() will always return date and time at which each
SYDATE() function started execution. For example.
mysql> Select now(), sleep(2), now();
Output: 2018-12-04 10:26:20, 0, 2018-12-04 10:26:20
mysql> Select sysdate(), sleep(2), sysdate();
Output: 2018-12-04 10:27:08, 0, 2018-12-04 10:27:10

E 59
XII CBSE / Informatics Practices

SQL — MINUS
 The MINUS compares the results of two queries and returns distinct rows from the result set of the
first query that does not appear in the result set of the second query.

TABLE T1 TABLE T2
 Select Empid drom T1
 MINUS
 Select Empid from T2;
SQL — UNION
 The UNION operator allows you to combine two or more result sets of queries into a single result set.

 Select Empid from T1


 UNION
 Select Empid from T2;
SQL — INTERSECT
 The INTERSECT operator compares the result sets of two queries and returns the distinct rows
that are output by both queries.
 To use the INTERSECT operator for two queries, you follow these rules:
– The order and the number of columns in the select list of the queries must be the same.
– The data types of the corresponding columns must be compatible.

TABLE T1 TABLE T2

 Select Empid from T1


 INTERSECT
 Select Empid from T2;

60 E
CBSE

(A) MULTIPLE CHOICE QUESTIONS
Q.1 Which of the following is not a legal sub-language of SQL ?
(1) DDL (2) QAL (3) DML (4) TCL
Ans. (2)
Q.2 Which one of the following uniquely identifies the tuples / rows in a relation.
(1) Secondary Key (2) Primary Key (3) Composite Key (4) Foreign Key
Ans. (2)
Q.3 A ____ is a property of the entire relation, which ensures through its value that each tuple is
unique in a relation.
(1) Rows (2) Key (3) Attributes (4) Fields
Ans. (2)
Q.4 Consider the following SQL Statement. What type of statement is this ?
INSERT INTO instructor VALUES (10211, ‘SHREYA’ , ‘BIOLOGY’, 69000);
(1) Procedure (2) DML (3) DCL (4) DDL
Ans. (2)
Q.5 What is anamein the following SQL Statement ?
SELECT aname FROM table1 UNION SELECT aname FROM table2;
(1) row name (2) column Name (3) table name (4) database name
Ans. (2)

(B) NCERT BASED QUESTIONS


Very Short Answer Type Questions
Q.1 What is a primary key?
Ans. A Primary key is a field or a combination of fields that can uniquely identify a row/tuple in a
table/relation.
Q.2 What is a unique key ? It is a Primary key?
Ans. A Unique key in table/relation is any non-primary key field which also stores unique values for
each row just like a primary-key does. But only one key is designated as primary key. So
unique refers to a unique non-key field of a table.
Q.3 Give some examples of DML commands. Or Write the name of any two DML Commands of SQL?
Ans. INSERT, UPDATE, SELECT and DELETE
Q.4 In SQL,write the query to display the list of tables stroe in database.
Ans. SHOW TABLES;
Q.5 What is wrong with following statement ?
SELECT * FROM Employee
WHERE grade = NULL;
Write the corrected form of the above SQL Statement.
Ans. A relation operator ‘=’ is not used with the NULL clause.
The Corrected form is :
SELECT * FROM Employee
WHERE grade is NULL;

E 61
XII CBSE / Informatics Practices

(C) CASE BASED QUESTIONS
Q.1 A library uses a database management system (DBMS) to store the details of the books that it
stocks, it registered members and the book-loans that the library has made. These details are
stored in a database using the following three relations.
Name of the Database : KV Library
• Book (BookID : Char(5), Title : Varchar(25), Author :Varchar(25), Publisher : Varchar(100))
• Member(MemberID:Char(5), LastName:Varchar(25), FirstName:Varchar(25), Correspondence-
Address : Varchar(100), Pincode : Char(6), DateofBirth : Date, EmailID : Varchar(50))
• Loan(MemberID: Char(5), BookID:Char(5), LastDate:Date, DueBackDate:Date, Returned:
Boolean)
Note : The Library does not stock more than one copy of the same book.
(a) Identify the table that uses a composite primary key from the library database.
(i) Book Table (ii) Member Table
(iii) Loan Table (iv) all of these
(b) I. Identify the possible alternate keys from relations Book and Member.
(i) Book : Title
(ii) Books Author
(iii) Member:EmailID
(iv) Member:FirstName’
II. Can the Loan relation have an alternate key ?Why ?
(c) Relations Book and Member have the following records :
Book
BookID Title Author Publisher
B1103 - - -
B2902 - - -
B2950 - - -
B3100 - - -
B3275 - - -
Member
BookID
B1103
B2902
B2950
B3100
B3275

Write an example of the valid record for the loan relation. Write a query to insert a valid
record in the Loan relation.

62 E
CBSE

(d) Write a SQL query to retrieve the names and email addresses of the members who have
not returned their books.
Ans. (a) (iii) Loan Table
(b) I. (i) Book : Title (ii) Member: EmailID
II. No, the Loan relation cannot have alternate key as its primary key is a composite key having
foreign key.
(c) INSERT INTO Loan Values(‘M1255’, ‘B3100’, ‘02/02/2020’, ‘09/02/2020’, False)
(d) Select FirstName, LastName, EmailID
From Member, Loan
Where Member.MemberID=Loan.MemberID
AND Returned = ‘False’;
Q.2 A library uses database management system(DBMS) to store the details of the books that it
stocks, its registered membes and the book-loan that the library has made. These details are
stored in a database using the following three relations. Name of the Database : KV Library
• Book (BookID : Char(5), Title : Varchar(25), Author :Varchar(25), Publisher : Varchar(100))
• Member(MemberID:Char(5), LastName:Varchar(25), FirstName:Varchar(25), Correspondence-
Address : Varchar(100), Pincode : Char(6), DateofBirth : Date, EmailID : Varchar(50))
• Loan(MemberID: Char(5), BookID:Char(5), LastDate:Date, DueBackDate:Date, Returned:
Boolean)
Note : The Library does not stock more than one copy of the same book.
(a) Identify following types of keys from all the relations of the given database Foreign keys
along with parent relations.
(b) Can a relation have multiple foreign keys? Give example.
(c) Can a foreign key be part of a primary key? Give example.
(d) Write a SQL query to retrieve the names and email addresses of the members belonging to
KVS (they have email ids as _____@kvs.in) and wo have not returned their books.
Ans. (a) Foreign Keys in Relation Loan
MemberID(Parent Table Member)
BookID (Parent Table Book)
(b) Yes, a relation can have multiple foreign keys, e.g., the loan relation given above has two
foreign keys – MemberID and BookID
(c) Yes, a foreign key can be a part of composite primary key, e.g., the primary key of relation
loan is : (MemberID, BookID, LoanDate), which contains two foreign keys : MemberID and
BookID.
(d) Select FristName,LastName, EmailID
From Member, Loan
Where Member.MemberID=Loan.MemberID
AND EmailID LIKE “%@kvs.in” AND Returned = ‘False’;

E 63
XII CBSE / Informatics Practices

Q.3 FurnFly is a furniture company selling furniture to customers of its store and operates a follows:
• The store does not keep the furniture in stock.
• The company places orders for the furniture required from its suppliers ONLY AFTER a
customer places an order at the store.
• When the ordered furniture arrives at the store, the customer is informed via telephone or e-
mail that it is ready for delivery.
• Customers often order more than one type of furniture on the same order, for example, a
sofa, two puffy chairs and centre table.
Details of the furniture, customers and orders are to be stored in a relational database using the
following four relations :
Database Name :FurnFly Furnishers
Furniture (FurnitureID : Char(7), FurnitureName : Varchar(50), Category : Varchar(25),
Price : Float, SupplierName : Varchar(100))
CustomerOrder(OrderId : Number(8,0), CustomerID : Char(10), OrderDate:Date)
CustomerOrderLine :(OrderID : Number(8,0), FurnitureID: Char(7), Quantity:
Number(4,0))
Customer :(CustomerID : Char(10), CustomerName:Varchar(100), EmailAddress :
Varchar(30), TelephoneNumber: Number(15,0))
(a) Identify the relationships among tables.
(b) Identify the relation having composite primary key and its primary key.
(c) Write a SQL query to create table customerOrder. It should also define required primary key
and foreign key(s)
(d) A fault has been identified with the furnitureID number 6281. The manager needs to known
how many orders need to be recalled. Write a SQL query for the same.
(e) A customer with ID number ‘C5104’ wants to change his registered telephone number as
9988776655. Write a SQL query to achieve this.
Ans. (a) Table Related to table (Key)
-------------------------------------------------------
CustomerOrder→Customer(CustomerID)
CustomerOrderLine→CustomerOrder(OrderID)
CustomerOrderLine→ Furniture (FurnitureID)
(b) CustomerOrderLine(OrderID, FurnitureID)
(c) Create Table CustomerOrder
(OrderIDNumber(8,0) Not Null Primary Key,
CustomerIDchar(ID) REFERENCE Customer(CustomerID),
OrderDate Date);
(d) Select count(*)
From CustomerOrderLine
Group by FurnitureID
Having FurnitureID = ‘6281’;
(e) Update Customer
Set TelephoneNumber=9988776655
Where CustomerID= ‘C5104’;

64 E
CBSE

Q.4 Rachana Mittal runs a beauty parlor. She uses a database management system(DBMS) to store
the information that she needs to manage her business. This information includes customer
contact details, staff names, the treatments that the parlor offer (for example, ‘’Hair Massage’)
and appointment that customers have made for treatments. A separate appointment must be
made for each treatment.
The details are stored in a database using the following four relations:
Customer: (CustomerID, FirstName, LastName, TelephoneNumber, EmailAddress)
Staff : (StaffID, FirstName,LastName, IsQualified)
Treatment: (TreatmentName,Price,TimeTaken,NeedsQualification)
Appointment : (CustomerID,TreatmentName,ApDate,ApTime)
The IsQualifiedattribute for a member of staff stores one of the value True or False, to indicate
if the member of staff is fully qualified or not.
The NeedsQualifictionattribute for a treatment stores True or False to indicate if the treatment
can only be given by a qualified member of staff.
The TimeTakenattribute for a treatment is the number of minutes (a whole number) that the
treatment takes.
(a) Write a SQL statement to create the table staff.
(b) Write a query to Insert a record in the table Staff with following data ;
(2009,‘Sheril’, ‘Mark’, ‘True’)
(c) Which table’s records can be deleted without affecting any other table?
(i) Customer (ii) Staff (iii) Treatment (iv) Appointment
(d) Write a query to Modify table Appointment to add a new column StaffID, which should
hold a legal StaffID value from the staff table.
(e) Rachana wants to send e-mail advertisement to all the customers who had a ‘RF Facial’
treatmentin 2020. To send the email, the customer’s email address, firstname and
lastname are needed.
Write a SQL query to retrieve the email address, firstname and lastname of each customer to
whom email should be sent.
Ans. (a) Create Table Staff
(StaffID Number(4,0) NOT NULL PRIMARY KEY,
FirstName Varchar(20) NOT NULL,
LastNameVarchar(20),
ISQualifiedChar(4) Check (IsQualified IN(‘True’, ‘False’)));
(b) INSERT INTO Staff Values(2009, ‘Sheril’, ‘Mark’, ‘True’);
(c) (ii) Staff table’s records can be deleted without affecting any other table as of now, because
this table is not linked with any other table yet.
(d) Alter Table Appointment Add StaffIDNumber(4,0) NOT NULL Reference Staff(StaffID);
(e) Select EmailAddress, FirstName,LastName
From Customer C, Appointment A
Where C.CustomerID=A.CustomerID
AND TreatmentName= ‘RF Facial’;

E 65
XII CBSE / Informatics Practices

Q.5 Consider the table STUDENT given below:
Roll No. Name Class DOB Gender City Marks
1 Anand XI 6/6/97 M Agra 430
2 Chetan XII 7/5/94 M Mumbai 460
3 Geet XI 6/5/97 F Agra 470
4 Preeti XII 8/8/95 F Mumbai 492
5 Saniyal XII 8/10/95 M Delhi 360
6 Maakhiy XI 12/12/94 F Dubai 256
7 Neha X 8/12/95 F Moscow 324
8 Nishant X 12/6/95 M Moscow 429
(a) State the command that will give output as:
Name
Anand
Chetan
Geet
Preeti
(i) Select Name from student where class= ‘XI’ and class=‘XII’;
(ii) Select Name from student where not class= ‘XI’ and class=‘XII’;
(iii) Select Name from student where city = ‘Agra’ or city = ‘Mumbai’;
(iv) Select Name from student where city IN(‘Agra’ , ‘Mumbai’);
Choose the correct option :
(a) Both (i) and (ii)
(b) Both (iii) and (iv)
(c) any of the option (i) , (ii) and (iv)
(d) Only (iii)
(b) What will be the output of the following command?
Select * from student where gender= ‘F’ order by marks;
(i)
RollNo Name Class DOB Gender City Marks
4 Preeti XII 8/8/95 F Mumbai 492
3 Geet XI 6/5/97 F Agra 470
7 Neha X 8/12/95 F Moscow 324
6 Maakhiy XI 12/12/94 F Dubai 256
(ii)
RollNo Name Class DOB Gender City Marks
6 Maakhiy XI 12/12/94 F Dubai 256
7 Neha X 8/12/95 F Moscow 324
3 Geet XI 6/5/97 F Agra 470
4 Preeti XII 8/8/95 F Mumbai 492

66 E
CBSE

(iii)
Gender Marks
F 256
F 324
F 470
F 492
(iv)
Gender Marks
F 492
F 470
F 324
F 256
(iii) Prachi has given the following command to obtain the highest marks
SELECT 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 students;
(d) Select class, max(Marks) from student group by class;
(iv) State the command to display the average marks scored by students of each gender who are
in class XI?
(a) Select Gender, avg(Marks) from student where class= ‘XI’ group by gender;
(b) Select Gender, avg(Marks) from student group by gender where class= ‘XI’;
(c) Select Gender, avg(Marks) group by Gender from student having class= ‘XI’;
(d) Select Gender, avg(Marks) from student group by Gender having class= ‘XI’;
Choose the correct option:
(a) Both (ii) and (iii)
(b) Both (ii) and (iv)
(c) Both (i) and (iii)
(d) Only (iii)
(v) 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;
Ans. (i) (b) Both (iii) and (iv)
(ii) (b)
(iii) (d)
(iv) (b) Both (ii) and (iv)
(v) (b)

E 67
XII CBSE / Informatics Practices

(D) TRUE OR FALSE
Q.1 Part of SQL which creates and defines tables and other database objects, is called DDL
Ans. True
Q.2 Part of SQL which manipulates data in tables, is called TCL
Ans. False
Q.3 Part of SQL which access and manipulates data in tables is called DML
Ans. True
Q.4 SQL is a case sensitive.
Ans. False
Q.5 Functions MID() and SUBSTR() do the same thing.
Ans. True

(E) FILL IN THE BLANKS


Q.1 To remove duplicate rows from the result of a query, specify the SQL qualifier_____ in select
list.
Ans. Distinct
Q.2 To obtain all columns, use a(n) _______ instead of listing all the column names in the select
list.
Ans. ASTRIK(*)
Q.3 The SQL _______ clause contains the condition that specifies which rows are to be selected.
Ans. Where
Q.4 The SQL keyword _______ is used in SQL expressions to select records based on patterns.
Ans. Like
Q.5 The ________ operator is used for making range checks in SELECT queries.
Ans. Between

(F) ASSERTION AND REASON


Direction: In the following questions, a statement of assertion (A) is following by a statement of
reason (R), Mark the correct choice as:
Q.1 Assertion (A): SELECT MOD(15, 3); will produce the output as 0 (Zero).
Reason (R): POWER( ) function is used to get the power of the given values.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (2)

68 E
CBSE

Q.2 Assertion (A): SELECT MOD(15, 5); will produce the output as 0 (Zero).
Reason (R): MOD( ) function is used to return the remainder of one expression by dividing it
to another expression.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (1)
Q.3 Assertion (A): UPPER () function is used to convert the string argument into upper case
characters.
Reason (R): UCASE () function is used to convert the string argument into lower case
characters.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (3)
Q.4 Assertion (A): HAVING clause is oftenly used with the GROUP BY statement.
Reason (R): HAVING clause is used to check specified condition.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (1)
Q.5 Assertion (A): AVG() function calculates the average of specified column(s).
Reason (R): It doesn't ignore NULL values.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (3)

E 69
XII CBSE / Informatics Practices

IMPORTANT NOTES

_______________________________________________________________________

_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________

_______________________________________________________________________

_______________________________________________________________________

70 E
CBSE

CHAPTER-4 : INTRODUCTION TO COMPUTER NETWORKS
Introduction to Networks
The collection of interconnected computers is called a computer network. Two computers are said to
be interconnected if they are capable of sharing and exchanging information.

Need of Computer Network


Resource Sharing :- Resource Sharing means to make all programs, data and peripherals available to
anyone on the network irrespective of the physical location of the resources and the user.
Reliability :- Reliability means to keep the copy of a file on two or more different machines, so if one
of them is unavailable (due to some hardware crash or any other) them its other copy can be used.
Cost Factor :- Cost factor means it greatly reduces the cost since the resources can be shared.
Available aggregate functions are –

Application of Computer Networks


1. Sharing of data, services and resources
2. Access to remote database
3. Communication facilities
4. Time saving
Elementary Terminology of Networks :-
1. Nodes (Workstations):- The term nodes refer to the computers that are attached to a network
and are seeking to share the resources.
Server:- A computer that facilitates the sharing of data, software and hardware resources on the
network.

E 71
XII CBSE / Informatics Practices

MAC Address: A (Media access Control) address is a hardware identification number that
uniquely identifies each device on a network (assigned to a NIC by the manufacturer).
IP Address: Each computer on internet is identified by a unique number called IP Address. E.g:

Types of Computer Networks


LAN (Local Area Network): A Local Area Network (LAN) is a network that is limited to a relatively
small area. It is generally limited to a geographic area such as a school building, office or a university
campus. It is generally privately owned networks over a distance not more than 5 Km. e.g. network in a
college, school, hospital etc.

MAN (Metropolitan Area Network): MAN is the networks that cover a group of nearby corporate
offices or a city and might be either private or public. E.g. Cable TV Network in a city.

72 E
CBSE

WAN (Wide Area Network): These are the networks spread over large distances, say across countries
or even continents through cabling or satellite uplinks are called WAN. E.g. Internet
PAN (Personal Area Network): A PAN is a network of communicating devices (Computer, Phone,
MP3/MP4 Player, Camera etc.) organized around an individual person. A PAN can be set up using
guided media (USB cable) or unguided media (Bluetooth, Infrared).

Network Devices
1. Modem:-A modem (modulator/demodulator) is a hardware device that allows a computer to send
and receive information over telephone lines. When sending a signal, the modem converts
(modulates) digital data to an analog signal and transmit it over a telephone line. Similarly when
an analog signal is received, the modem converts it back (demodulates) to a digital signal.
2. Hub:- A Hub is an electronic device that connects several computers together to form a network
and redirects the received information to all the connected nodes in broadcast mode. The
computer(s) for which the information is intended receive(s) this information and accept(s) it.
Other computers on the network simply reject this information.
Example of how a hub works is shown below. Computer A wants to send a message to computer
B. It sends the message through the Ethernet cable to the hub, then the hub repeats the message to
all of the connected computers.

E 73
XII CBSE / Informatics Practices

Types of Hub-
Passive Hub: This type of does not amplify or boost the signal. It does not manipulate or view
the traffic that crosses it.
Active Hub: It amplifies the incoming signal before passing it to the other ports.

3. Switch :- A switch is a network device which is used to interconnect computers or devices on a


network. It filters and forwards data packets across a network. The main difference between hub
and switch is that hub replicates what it receives on one port onto all 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.

Diagram of A 4-Port Switch


Example of how a switch works is shown below. Using a switch, computer A sends a message to
computer B—the other computers do not see the message. Those computers can send other
messages at the same time without interfering.

74 E
CBSE

4. Repeater :- A Repeater is a device that is used to amplify and regenerate a signal which is on its
way through a communication channel. A repeater regenerates the received signal and re-
transmits it to its destination.
5. Router :- A device that forwards data packets from one network to another by finding the
shortest route, based on an internal routing table and the address of the destination network in the
incoming packet, the router determines whether to send the packet out (in other network) or keep
it or forward within the own network.

Gateway :- A gateway is a device that connects dissimilar networks (Networks with different software
and hardware configurations and with different transmission protocol).

Network Topologies
Topology means the way by which a network is formed.

E 75
XII CBSE / Informatics Practices

1. Bus Topology

Bus Topology :-Bus topology is a topology for a Local Area Network (LAN) in which all the nodes
are connected to a single cable.
The starting and ending point of cable is called terminator.
ADVANTAGES
• It is easy to install.
• It requires less cable length and hence it is cost effective.
• Failure of a node does not affect the network.
DISADVANTAGES
• In case of cable or terminator fault, the entire network breaks down.
• Not suitable for large number of computers.
• At a time only one node can transmit data.
The STAR Topology: -

A STAR topology is based on a central node which acts as a hub. In star topology each node is directly
connected to a Hub/Switch.
Advantages:
• Easy to troubleshoot
• 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.

76 E
CBSE

Disadvantages:-
• Difficult to expand.
• Longer cable is required.
• The cost of the hub and the longer cables makes it expensive over others.
• In case hub fails, the entire network stop working.
TREE Topology
Tree topology is a combination of bus and star topologies. It is used to combine multiple star topology
networks. All the stars are connected together like a bus.

Features of Tree Topology


• Ideal if workstations are located in groups.
• Used in Wide Area Network.
Advantages of Tree Topology
• Extension of bus and star topologies.
• Expansion of nodes is possible and easy.
• Easily managed and maintained.
• Error detection is easily done
Disadvantages of Tree Topology
• Heavily cabled.
• Costly.
• If more nodes are added maintenance is difficult.
• Central hub fails, network fails.

E 77
XII CBSE / Informatics Practices

Mesh Topology :-

Mesh topology is a group of nodes which are all connected to each other and many types of
connections are possible in a mesh topology.
Advantage of Mesh Topology
• The arrangement of the network nodes is such that it is possible to transmit data from one node
to many other nodes at the same time.
• Fault is diagnosed easily.
Disadvantage of Mesh Topology
• Installation and configuration is difficult.
• Cabling cost is more.
• Bulk wiring is required.

Introduction to Internet
The Internet is a massive network of networks, a networking infrastructure. It connects millions
of computers together globally, forming a network in which any computer can communicate with
another computer as long as they are both connected to the Internet. The World Wide Web, or
simply Web is a way or medium of accessing information over the Internet. It is an information
sharing model that is built on top of the Internet.

78 E
CBSE

” The Internet emerged in the United States in the 1970s but did not become visible to the general
public until the early 1990s. By 2020, approximately 4.5 billion people, or more than half of the
world’s population, were estimated to have access to the Internet”.
The Internet provides a capability so powerful and general that it can be used for almost
any purpose that depends on information, and it is accessible by every individual who
connects to one of its associated networks.
URL :- URL stands for Uniform Resource Locator. A URL is nothing more than the address of a
given unique resource on the Web or address of a website. The URL is an address that matches
users to a specific resource online, such as webpage.
Example- http://www.python4csip.com
WWW : The World Wide WEB (WWW), commonly known as the ‘Web’. It is an information
system where all the web resources are identified by Uniform Resource Locator (URL). Tim
Berners-Lee invented the WWW in 1989. He wrote the first web browser in 1990.
The World Wide WEB (WWW) or ‘Web’ is a collection of WebPages found over the
internet. Web browser uses the internet to access the ‘Web’.
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
The Main characteristics of web 2.0 are:
 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 supports semantic web 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 keywords and numbers.
e-mail: email (or e-mail) is defined as the transmission of messages over communications
networks. Typically the messages are notes entered from keyboard and sent over internet using
computer or mobile.
Chat : Chat may refer to any kind of communication over the Internet that offers a real-time
transmission of text messages from sender to receiver. Chat messages are generally short in order
to enable other participants to respond quickly.
Voip :- Voice over Internet Protocol (VoIP), is a technology that allows you to make voice calls
using a broadband Internet connection instead of a regular (or analog) phone line. VoIP services
convert your voice into a digital signal that travels over the Internet. If you are calling a regular
phone number, the signal is converted to a regular telephone signal before it reaches the
destination. VoIP can allow you to make a call directly from a computer. Examples of VOIP:-
Whatsapp, Skype, Google Chat etc.

E 79
XII CBSE / Informatics Practices

Advantage of VOIP:
 Save a lot of money.
 More than two people can communicate or speak.
 Supports great audio transfer.
 Provide conferencing facility.
 More than voice (can transfer text, image, video along with voice).
Disadvantages of VOIP:
 Reliable Internet connection required.
 No location tracking for emergency calls.
Website : a website is a group of web pages, containing text, images and all types of multi-media files.
Difference between Website and Webpage :-
Website Webpage
1. A collection of web pages which are A document which can be displayed in a web
grouped together and usually connected browser such as Firefox, Google Chrome,
together in various ways, Often called a Opera, Microsoft Internet Explorer etc.
"web site" or simply a "site."
2. Has content about various entity. Has content about single entity.
3. More development time is required. Less development time is required.
4. Website address does not depend on Webpage address depends on Website address.
Webpage address.
Difference between Static and Dynamic webpage :-
Static Webpage Dynamic Webpage
The static web pages display the same In the dynamic Web pages, the page content
content each time when someone visits it. changes according to the user.
It takes less time to load over internet. Dynamic web pages take more time while
loading.
No Database used. A database is used in at the server end in a
dynamic web page.
Changes rarely. Changes frequently.
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.

80 E
CBSE

The basic objective of the web server is to store, process and deliver web pages to the users using
Hypertext Transfer Protocol (HTTP). Apart from HTTP, a web server also supports SMTP
(Simple Mail transfer Protocol) and FTP (File Transfer Protocol) protocol for e-mailing, for file
transfer and storage.
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.
Types of Web Hosting:

Web Browswer :- 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.
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.
Add-ons( in terms of H/W): 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- ons
are common for games, word-processing and accounting programs.
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 modest amount of data specific to a particular client and website and can be
accessed by the web server or the client computer.
Cookies are stored in Hard-drive and are referenced by web browser.
E 81
XII CBSE / Informatics Practices

(A) MULTIPLE CHOICE QUESTIONS
Q.1 The main computer in any network is called as
(1) Client (2) Server (3) Hub (4) Switch
Ans. (2)
Q.2 What is the full form of NIC
(1) Network Interchange Card
(2) Net Interconnect Card
(3) Network Interface Card
(4) Network Interconnection Card
Ans. (3)
Q.3 A network with all client computer and no server is called
(1) Networking (2) Peer to Peer Computing
(3) Client Server Computing (4) Any of them
Ans. (2)
Q.4 IP Stands for
(1) Internet Protocol (2) Intranet Protocol
(3) Internet Practice (4) Intranet Practice
Ans. (1)
Q.5 Which of this is not a part of URL
(1) IP Address (2) Port Number
(3) Domain Name (4) None of these
Ans. (1)

(B) NCERT BASED QUESTIONS


Very Short Answer Type Questions
Q.1 What is the need for a network.
Ans. Network is the interconnection between systems for resource sharing like printing and internet
sharing.
Q.2 Write the full form of following :
a. NIC
b. ICT
c. PCB
d. DND
e. STP
f. UTP
g. CAT-6
h. CRT
i. TFT
j. LED

82 E
CBSE

Ans. FULL ABBRIBIATION
NIC→Network Interface Card
ICT→Information and Communication Technology
PCB→Printer Circuit Board
DND→Do Not Disturb Directory
STP→Shielded Twisted Pair
UTP→Un-Shielded Twisted Pair
CAT-6→Category 6 Cables
CRT→Cathod Ray Tube
TFT→Thin Film Transistor
LED→Light Emmited Diode
Q.3 Expand LAN and PAN
Ans. LAN- LOCAL AREA NETWORK / PAN – PERSONAL AREA NETWORK
Q.4 How internet is difference from LAN or Networks?
Ans. Internet is the network of networks and LAN is only a single network.
Q.5 What is the use of ISP in internet networks?
Ans. It is the Internet Service Provider for the Clients.

(C) CASE BASED QUESTIONS


I. ABC Pvt Ltd. is setting up the network in Bengaluru. There are four departments named as
market, Finance, Legal and Sales.
Distance between various buildings is as follows:
Market to Finance 80 mt
Market to Legal 180 mt
Market to Sales 100 mt
Legal to Sales 150 mt
Legal to Finance 100 mt
Finance to Sales 50 mt
Number of computers in the buildings:
Market 20
Legal 10
Finance 08
Sales 42
Q.1 Suggest the best possible topology to be used.
(1) Star (2) Ring (3) Tree (4) Mesh
Ans. (1)
Q.2 Suggest the most suitable building to place the server.
(1) Market (2) Legal (3) Finance (4) Sales
Ans. (4)
Q.3 Suggest the placement of hub/switch in the network.
(1) Market (2) Finance (3) Legal (4) All Buildings
Ans. (4)
E 83
XII CBSE / Informatics Practices

Q.4 The organisation is planning to link its sale counter situated in various part of the same city.
Which type of network will be formed?
(1) LAN (2) MAN (3) WAN (4) PAN
Ans. (2)
Q.5 Which of the following communication media will you suggest to be procured by the company
for connecting their offices for very effective and fast communication?
(1) Ethernet cable (2) Optical fiber
(3) Telephone cable (4) Twisted pair cable
Ans. (2)

(D) TRUE OR FALSE


Q.1 Router is a networking device that forwards the data packets between computer networks.
Ans. True
Q.2 Bluetooth is an example of wide area network.
Ans. False
Q.3 The World Wide Web ("WWW" or "The Web") is the part of the Internet that contains websites
and webpages.
Ans. True
Q.4 When sending an Email, the cc line describes the contents of the message.
Ans. False
Q.5 Email address separates the user name from the domain name using the @ symbol.
Ans. True

(E) FILL IN THE BLANKS


Q.1 Repeaters work on the __________ layer
(1) Network Layer (2) Physical Layer (3) Application Layer (4) All of the Above
Ans. (2)
Q.2 Communication Media can be of ___________ and _____________ type
(1) Twisted pair , Shielded Twisted pair (2) Fiber optics , coaxial
(3) Guided , Unguided (4) Wire , Laser
Ans. (3)
Q.3 To prevent unauthorized access to and / or from the network, a system known as
____________, can be implemented by hardware and / or software
(1) Antivirus (2) Firewall (3) Software (4) Hardware
Ans. (2)
Q.4 Bluetooth is an example of __________
(1) personal area network (2) local area network
(3) virtual private network (4) wide area network
Ans. (1)
Q.5 Repeaters work on the ___________ layer.
(1) Network Layer (2) Physical Layer (3) Application Layer (4) All of the Above
Ans. (2)

84 E
CBSE

(F) ASSERTION AND REASON
Direction: In the following questions, a statement of assertion (A) is following by a statement of
reason (R), Mark the correct choice as:
Q.1 Assertion (A): Cookies are plain text files.
Reason (R): Cookies store the Profile picture on Social Media.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (3)
Q.2 Assertion (A): A router is more powerful and intelligent than hub or switch.
Reason (R): It has advanced capabilities as it can analyse the data and decide the data is packed
and send it to the other network.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (1)
Q.3 Assertion (A): Browser is the software to access internet based webpage in the computer.
Reason (R): Local Area Network (LAN) is a network where two or more computers are
connected within 1 km.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (2)
Q.4 Assertion (A): The repeater is a device that amplifies the network over geographical distance.
Reason (R): A hub is a device which is used to connect more than one device in the network.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (2)

E 85
XII CBSE / Informatics Practices

Q.5 Assertion (A): The web is the common name for the World Wide Web, a subset of the Internet
consisting of the pages that can be accessed by a web browser.
Reason (R): URL is a unique identifier used to locate a resource on the Internet.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (2)

86 E
CBSE

CHAPTER-5 : SOCIETAL IMPACTS
Digital Footprint
A digital footprint, sometimes called digital dossier is a body of data that you create while using the
Internet. It includes the websites you visit, emails you send, and information you submit to online
services and can be traced back by an individual.
It is of two types-
1. A passive digital footprint is created when data is collected without the owner knowing. A more
personal aspect of your passive digital footprint is your search history, which is saved by some
search engines while you are logged in.
2. Active digital footprints are created when a user, for the purpose of sharing information about
oneself by means of websites or social media, deliberately. An "active digital footprint"
includes data that you intentionally submit online. Sending an email contributes to your active
digital footprint, since you expect the data be seen and/or saved by another person. The more
email you send, the more your digital footprint grows.
Publishing a blog and posting social media updates are another popular ways to expand your
digital footprint. Every tweet you post on Twitter, every status update you publish on Facebook,
and every photo you share on Instagram contributes to your digital footprint.

Net and Communication Etiquettes


Netiquette is short for "Internet etiquette." Just like etiquette is a code of polite behavior in
society, netiquette is a code of good behavior on the Internet. This includes several aspects of the
Internet, such as email, social media, online chat, web forums, website comments, multiplayer
gaming, and other types of online communication.
While there is no official list of netiquette rules or guidelines, the general idea is to respect others
online. Below are ten examples of rules to follow for good netiquette:

E 87
XII CBSE / Informatics Practices

1. Avoid posting inflammatory or offensive comments online.
2. Respect others' privacy by not sharing personal information, photos, or videos that another
person may not want published online.
3. Never spam others by sending large amounts of unsolicited email.
4. Show good sportsmanship when playing online games, whether you win or lose.
5. Don't troll people in web forums or website comments by repeatedly nagging or annoying
them.
6. Stick to the topic when posting in online forums or when commenting on photos or videos,
such as YouTube or Facebook comments.
7. Don't swear or use offensive language.
8. Avoid replying to negative comments with more negative comments. Instead, break the
cycle with a positive post.
9. If someone asks a question and you know the answer, offer to help.
10. Thank others who help you online.

Data Protection
Data protection refers to the practices, safeguards, and binding rules put in place to protect your
personal information and ensure that you remain in control of it. In short, you should be able to
decide whether you want to share some information or not, who has access to it, for how long, for
what reason, and who be able to modify some of this information
Personal data is any information relating to you, whether it relates to your private, professional,
or public life. In the online environment, where vast amounts of personal data are shared and
transferred around the globe instantaneously,
It is increasingly difficult for people to maintain control of their personal information. This is
where data protection comes in.

Intellectuals Property Rights (IPR)


• Intellectual property refers to intangible property that has been created by individuals and
corporations for their benefit or usage such as copyright, trademark, patent and digital data. It is
therefore unethical to copy or steal the creativity and efforts of someone else.
Intellectual property is divided into categories which are-
• industrial property which majorly speaks about protecting inventions on the other hand
• Copyright majorly protects literary and artistic works.

88 E
CBSE

INDUSTRIAL PROPERTY
Which include inventions (patents), commercial names, industrial designs, trademarks, geographic
indications and designations etc.

Plagiarism
• Plagiarism means not giving authors credit after copying that author's work.
• It involves lying, cheating, theft and dishonesty. For example, copying papers written by other
people and professional and claims it as written by you can be an example of plagiarism.
• It can be classified as
1. Accidental / unintentional
2. Deliberate / intentional
Accidental/unintentional plagiarism Deliberate/intentional plagiarism
1. Involves careless paraphrasing (changing Includes copying someone else's work,
the words or sentence construction of a cutting and passing blocks of text or any
copied document), quoting text excessively kind of information from electronic sources
along with poor documentation. without the permission of the original
author.
2. Accidental Plagiarism cases are less serious Deliberate plagiarism that may result in
serious implications

HOW TO AVOID PLAGIARISM?

Plagiarism should be avoided by the following simple measures:


• Use your own ideas and words.
• Always provide a reference or give credit to the source from where you have received
information.
• Cite the name of the website, a URL or the name of authors, and acknowledge them if you have
used their work after rearranging the order of a sentence and changing some of the work.
• Take the information in the form of bulleted notes in your words.
• Use online tools to check for plagiarism.
• Develop your writing skills.

Licensing and copyright

• A Software license is a legal permission or right to use or redistribution of that software.


• The software can run on a certain number of computers as per license agreement.
• The software license usually answers questions such as-
1. Can you copy, modify or redistribute it?
2. Where and how many times can you install the software?

E 89
XII CBSE / Informatics Practices

3. Can you look at the underlying source code?

PROPRIETARY LICENSES :
Exclusive rights in the software are retained with the owner/developer/publisher. They reserve all the
freedom and rights to use and distribute this proprietary software.
FREE AND OPEN SOURCE SOFTWARE :
• Refers to software that users can safely run, adapt and redistribute without legal restraint, and
which emphasizes freedom.
• Open source software (OSS) is software with a source code that is publically available under
general public licenses that give users the right to study, modify and distribute that software and
emphasizes security, cost saving, and transparency.
• Hence FOSS (free and open source software) allows using, copying, studying and modifying the
software and the source code to be openly shared and allow copyrights to other users.

PERMISSIVE LICENSES :
• Permissive licenses provide a royalty-free license to do virtually anything with the source code.
• They permit using, copying, modifying, merging, publishing, distributing, sublicense and/or
selling, but distribution can only be made without the source code as source code modifications
can lead to permissive license violation.

COPYLEFT LICENSE :
• In the case of copyleft licenses, source code has to be provided.
• Distribution and modification of source code is permitted. Example General Public (GPL),
Creative Commons License (CC), Lesser General Public License (LGPL), Mozilla Public
License (MPL), etc.

90 E
CBSE

Copyright
It is a form of protection given to the authors of "original works of authorship". This is given in
the field of literature, dramatics, music, software, art etc. This protection applies to published as
well as unpublished work.
Software copyright is used by software developers and proprietary software companies to prevent
the unauthorized copying of their software. Free and open source licenses also rely on copyright
law to enforce their terms.
Copyright protects your software from someone else copying it and using it without your
permission.
When you hold the copyright to software, you can-
• Make copies of it.
• Distribute it.
• Modify it.

Cyber Crime
• Cybercrime is defined as "cybercrime (computer crime) is an illegal behaviour, done through
electronic operations, that targets the security of computer systems and the data processed by them".
• In other words cyber is a crime in which the offense is done using a computer or we can say a
computer is the object of the crime. Common types of cybercrime include identity theft,
unauthorized computer access, online bank information that and online predatory crimes.
Cybercrime includes a large range of activities but it can be classified into 2 categories :
• Crimes that target computer networks or devices. These types of crimes include viruses and
denial of service (DoS) attacks.
• Crimes that use computer networks to advance other criminal activities. These types of crimes
include cyber-stalking, phishing and fraud or identity theft.

Cyber Laws
Cyber law is the part of overall legal system that deals with the Internet, cyberspace, and their
respective legal issue. Cyber law covers broad area including freedom of expression, access to and
usage of the Internet, and online privacy. Generally cyber law is known as "Law of the Internet".
Importance of Cyber Law:
1. It covers all transaction over internet.
2. It keeps eyes on all activities over internet.
3. It touches every action and every reaction in cyberspace.

Hacking
Hacking is identifying weakness in computer systems of networks to exploit its weaknesses to
gain access. Example of hacking, Using password cracking algorithm to gain access to a system.
Computers have become mandatory to run successful businesses. It is not enough to have
isolated computers systems, they need to be networked to communicate with external businesses.
This exposes them to the outside world and hacking. Hacking means using computers to commit
fraudulent acts such as fraud, privacy attack, stealing corporate/personal data, etc.

E 91
XII CBSE / Informatics Practices

Phishing
Phishing is an attempt to capture a user's login password and credit card details by including a
URL in a spam e-mail that links to a fake website controlled by the attacker as a trustworthy
entity.

Cyber Bullying
Cyber bullying is the harassment or bullying executed through digital devices like computers,
laptops, smart phones, and tablets. The platforms where cyber bullying can occur include social
media, chat rooms, and gaming platforms where people can view and participate in the sharing of
content.
The different types of cyber bullying involve causing humiliation through hateful comments on
online platforms/apps, or through SMS or messaging. It comprises posting, sending or sharing
negative, nasty or false information about another individual for causing humiliation and
character assassination.

Indian-IT Act, 2000


• Information technology act 2000/ITA-2000/IT act is an act of the Indian parliament notified on 17
oct 2000.
• This primary law deals with cybercrimes and electronic commerce in India.
• It consists of 94 sections that are divided into 13 chapters and 4 schedules.
• A person of other nationalities can also be indicated under the law if the crime involves a computer
or network located in India, which means the law applies to the whole of India.
• The IT Act, 2000 has provisions that permits the interception, monitoring of traffic data.

The cyber laws in India and the provision for legal action and punishment have been explained-
Section Offense Penalty
67 A Publishing images containing sexual acts Imprisonment up to seven years and/or
fine up to 10 lakh
67 B Publishing child porn or predating Up to five years and/or fine up to 10
children online imprisonment lakh on 1st conviction
67 C Failure to maintain records Imprisonment up to three years and/or
fine up to 2 lakh
68 Failure/refusal to comply with orders Imprisonment up to seven years, and/or
possible fine
69 Failure/refusal to decrypt date Imprisonment up to three years, and/or
fine up to 1 lakh
70 Securing access or attempting to secure Imprisonment up to ten years, and/or
access to protected system fine

92 E
CBSE

IT Act, 2000 Amendment :
• A major amendment was made in 2008.
• It introduced section 69, which gave authorities the power of "interception/monitoring/
decryption" of any information through any computer resource.
• It also introduced 66A which penalized sending of "offensive massages".
• Amendments also contained penalties for child pornography, cyber terrorism, and surveillance.
• The act was passed in December 2008 and came into force in October 2009.

E-Waste, Hazards and Management

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

• Mostly all electronic waste comprises of toxic chemicals such as lead, beryllium, mercury etc.
• Improper disposing of gadgets and devices increases the amount of these toxic chemicals thus
contaminated the soil, causing air and water pollution.
• The contaminated water which is highly polluted it thus making it harmful for drinking
purposes.
• Improper e-waste recycling, such as by open burning and acid baths creates hazardous and toxic
compounds like-dioxins, furans and acids.
• Damage to the immune system.
• Skin disease.
• Multi ailments.
• Skin problems.

E-Waste Management
E-waste management requires proper recycling and recovery of the disposed material. The recycling
and recovery process includes following steps-
1. Dismantling :- removal of parts containing valuable items such as-copper, silver, gold, steel and
removal of parts containing dangerous substance like-mercury, lead, Beryllium etc.
2. Separation metal and plastic
3. Refurbishment and reuse :- It means used electrical and electronic items that can be easily
remodel to make it's to reuse.
4. Recovery of valuable materials
5. Disposal of dangerous materials like- mercury, lead, Beryllium etc and disposed off in
underground landfill sites.

E 93
XII CBSE / Informatics Practices

Awareness about health concerns related to the use to Technology
Today, computer technologies provide people with many benefits, educational activities can be
designed, online shopping is available, it is possible to get in touch with people overseas and to
chat with them. It is possible to search for anything and sometimes. It is even possible to do one's
job at home without going to his or her office. If these technologies, which dominate our lives
more each passing day, are not used carefully.
Then it is inevitable for people to end up with certain illnesses like-
1. Neck strain
2. Vision Problem
3. Sense of isolation
4. Sleeping disorder
5. Stress
6. Loss of attention
7. Problem in social relationships of individuals.
8. Computer anxiety
9. Internet addiction etc.
In order to avoid these problems-
• One should learn how to use these technologies without experiencing any problem rather than
avoiding using them.
• Some of the users of computer technologies are not even aware of their health-related problem
that they have.
• Some of those who are aware of their illnesses see a doctor for various reasons. Users of
computer technologies should immediately take education on the healthy use of these
technologies.
• If the necessary precautions are not taken about this issue, individuals may have serious health
problems, and the institutions may face a serious decrease in work force as well as financial
losses.
(A) MULTIPLE CHOICE QUESTIONS
Q.1 The digital footprint can be saved in which of the following locations?
(1) Download folder (2) User account
(3) Browser settings and web server (4) Google Drive
Ans. (3)
Q.2 The term "Intellectual Property Rights" covers:
(1) Copyrights (2) Trademarks (3) Patents (4) All of these
Ans. (4)
Q.3 The primary law in India dealing with cybercrime and electronic commerce is:
(1) India's Technology (IT) Act, 2008
(2) India's Digital Information Technology (DIT) Act, 2000
(3) India's Information Technology (IT) Act, 2000
(4) The Technology Act, 2008
Ans. (3)

94 E
CBSE

Q.4 Following are the impact of e-waste on the environment. Choose the odd one out.
(1) Soil Pollution (2) Water Pollution (3) Air Pollution (4) Sound Pollution
Ans. (4)
Q.5 What is E-Waste?
(1) Edible Waste (2) Easter Waste (3) Electronic Waste (4) Eternal Waste
Ans. (3)

(B) NCERT BASED QUESTIONS


Very Short Answer Type Questions
Q.1 What is cyber safety?
Ans. Cyber safety is all about the responsible and safe use of Internet.
Q.2 Name any two types of software license.
Ans. (i) Proprietary license
(ii) Creative Common license
Q.3 What is identity protection?
Ans. Identity Protection is a method which provides you protection from identity theft.
Q.4 Name the methods for proper treatment of e-waste.
Ans. Recycling and Refurbishing.
Q.5 What are examples of e-waste?
Ans. Mobile phones, television, refrigerator, home appliances etc. are some of the examples of the e-
waste.

(C) CASE BASED QUESTIONS


I. The school offers Wi-Fi to the students of Class XII. For communications, the network
security-staff of the school is having a registered URL "school wifi.edu". On 17th September
2017, emails were received by all the students regarding expiry of their passwords. Instructions
were also given renew their password within 24 hours by clicking on particular URL provided.
On the bases of the above case study, answer the questions given below:
Q.1 Specify which type of cyber crime is it.
(1) Spamming (2) Phishing
(3) Identity Theft (4) Hacking
Ans. (2)
Q.2 URL stands for _________
(1) Universal Resource Loader (2) Universal Resource Locator
(3) Unite Research Loader (4) Uniform Resource Locator
Ans. (2)
Q.3 Unsolicited commercial email is known as:
(1) Malware (2) Virus
(3) Spam (4) Spyware
Ans. (3)

E 95
XII CBSE / Informatics Practices

Q.4 Wi-Fi stands for _________
(1) Wireless Internet Frequent Interface
(2) Wireless Functioning
(3) Wireless Fidelity
(4) Wireless Free Internet
Ans. (3)
Q.5 Ideally, what characters should be used in a password to make it strong?
(1) Letters and numbers only (2) Mixed Case (Upper and Lower)
(3) Special characters (4) All of above
Ans. (4)

(D) TRUE OR FALSE


Q.1 E-waste increasing day by day is blessings for the environment.
Ans. False
Q.2 We cannot dispose off e-waste completely.
Ans. True
Q.3 The legal and regulatory aspects of the internet refer to IT atc.
Ans. True
Q.4 A copyright is automatically granted to authors or creators of content.
Ans. True
Q.5 In FOSS source code is usually hidden from the users.
Ans. False

(E) FILL IN THE BLANKS


Q.1 _____________ deals with the protection of an individual's information which is implemented
while using the Internet on any computer or personal device.
(1) Digital agony (2) Digital privacy (3) Digital secrecy (4) Digital protection
Ans. (2)
Q.2 ____________is the practice of taking someone else's work or ideas and passing them off as
one's own:
(1) Plagiarism (2) Copyright (3) Patent (4) All of the above
Ans. (1)

Q.3 When someone steals someone else's personal information to commit theft or fraud, it is called
_________.
(1) Identity theft (2) Hacking (3) Computer piracy (4) Infringement
Ans. (1)

Q.4 WEEE is almost _______% of e-waste from solid waste.


(1) 5 (2) 10 (3) 15 (4) 20
Ans. (1)

96 E
CBSE

Q.5 The insulated wire has copper which causes ___________.
(1) skin disease or allergies or increase the risk of lung cancer
(2) can damage human's kidney, brain and human nervous system
(3) neurological disorders
(4) damage live and bones
Ans. (3)

(F) ASSERTION AND REASON


Direction: In the following questions, a statement of assertion (A) is following by a statement of
reason (R), Mark the correct choice as:
Q.1 Assertion (A): Digital footprint is nothing but the record of what a person does online.
Reason (R): Digital footprint includes e-mail you sent, information you shared, websites you
visited and the activities you took part online.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (2)
Q.2 Assertion (A): Open source software is usually developed as a public collaboration and made
freely available.
Reason (R): Intellectual property refers to the inventions, literary and artistic expressions,
design and symbols, names and logos.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (2)
Q.3 Assertion (A): Hacking is the act of unauthorised access to a computer, computer network or
any digital system.
Reason (R): Cyber crime refers to the use of a computer to commit a crime.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (2)

E 97
XII CBSE / Informatics Practices

Q.4 Assertion (A): Cyber bullying and trolling harass victim mentally and physically.
Reason (R): The Parliament of India passed its first Cyber law on the 17th October 2000, the
Information Technology (IT) Act, 2003, which provides the legal infrastructure for e-commerce
in India.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (3)
Q.5 Assertion (A): E-waste management is also known as urban mining.
Reason (R): Technology shapes different cultures and differentiates one from another.
(1) Both assertion (A) and reason (R) are true and reason (R) is the correct explanation of
assertion (A).
(2) Both assertion (A) and reason (R) are true but reason (R) is NOT the correct explanation of
assertion (A).
(3) Assertion (A) is true but reason (R) is false.
(4) Assertion (A) is false but reason (R) is true.
Ans. (1)

98 E
CBSE

IP SAMPLE QUESTION PAPER
CLASS XII (2023-24)
INFORMATICS PRACTICES (065)

Time Allowed : 3 hours Maximum Marks : 70


General Instructions:
(i) This question paper contains five sections, Section A to E.
(ii) All questions are compulsory.
(iii) Section A has 18 questions carrying 01 mark each.
(iv) Section B has 07 Very Short Answer type questions carrying 02 marks each.
(v) Section C has 05 Short Answer type questions carrying 03 marks each.
(vi) Section D has 02 questions carrying 04 marks each.
(vii) Section E has 03 questions carrying 05 marks each.
(viii) All programming questions are to be answered using Python Language only.

SECTION-A
1. A ____________is a device that connects the organisation’s network with the outside world of
the Internet. [1]
(i) Hub (ii) Modem (iii) Gateway (iv) Repeater
2. When e-waste such as electronic circuit boards are burnt for disposal, the elements contained in
them create a harmful chemical called ________which causes skin diseases, allergies and an
increased risk of lung cancer. [1]
(i) Hydrogen (ii) Beryllium (iii) Chlorine (iv) Oxygen
3. Copyright, Patent and Trademark comes under: [1]
(i) Intellectual Property Right
(ii) Individual Property Right
(iii) Industrial Property Right
(iv) None of the above
4. Predict the output of the following query: [1]
SELECT MOD (9,0);
(i) 0 (ii) NULL (iii) NaN (iv) 9
5. Which of the following SQL functions does not belong to the Math functions category? [1]
(i) POWER() (ii) ROUND() (iii) LENGTH() (iv) MOD()
6. ________ is not a FOSS tool. [1]
(i) Libre Office (ii) Mozilla Firefox
(iii) Google Chrome (iv) Python
7. CSV stands for: [1]
(i) Column Separated Value (ii) Class Separated Value
(iii) Comma Separated Value (iv) None of the above
E 99
XII CBSE / Informatics Practices

8. Raj, a Database Administrator, needs to display the average pay of workers from those
departments which have more than five employees. He is experiencing a problem while running
the following query: [1]
SELECT DEPT, AVG(SAL) FROM EMP WHERE COUNT(*) > 5 GROUP BY DEPT;
Which of the following is a correct query to perform the given task?
(i) SELECT DEPT, AVG(SAL) FROM EMP WHERE COUNT(*) > 5 GROUP BY DEPT;
(ii) SELECT DEPT, AVG(SAL) FROM EMP HAVING COUNT(*) > 5 GROUP BY DEPT;
(iii) SELECT DEPT, AVG(SAL) FROM EMP GROUP BY DEPT WHERE COUNT(*) > 5;
(iv) SELECT DEPT, AVG(SAL) FROM EMP GROUP BY DEPT HAVING COUNT(*) > 5;
9. Predict the output of the following query: [1]
SELECT LCASE (MONTHNAME ('2023-03-05'));
(i) May (ii) March (iii) may (iv) march
10. Which of the following command will show the last 3 rows from a Pandas Series named NP?[ 1 ]
(i) NP.Tail( ) (ii) NP.tail(3) (iii) NP.TAIL(3) (iv) All of the above
11. With reference to SQL, identify the invalid data type. [1]
(i) Date (ii) Integer (iii) Year (iv) Month
12. In Python Pandas, while performing mathematical operations on series, index matching is
implemented and all missing values are filled in with _____by default. [1]
(i) Null (ii) Blank (iii) NaN (iv) Zero
13. By restricting the server and encrypting the data, a software company's server is unethically
accessed in order to obtain sensitive information. The attacker blackmails the company to pay
money for getting access to the data, and threatens to publish sensitive information unless price is
paid. This kind of attack is known as: [1]
(i) Phishing (ii) Identity Theft (iii) Plagiarism (iv) Ransomware
14. In SQL, the equivalent of UCASE() is: [1]
(i) UPPERCASE() (ii) CAPITALCASE()
(iii) UPPER() (iv) TITLE ()
15. Collection of hyper linked documents available on the internet is known as____________. [ 1 ]
(i) Website (ii) Webpage (iii) Web Server (iv) Web Hosting
16. _______________is a non-profit organization that aims to build a publicly accessible global
platform where a range of creative and academic work is shared freely. [1]
(i) Creative Cost (ii) Critical Commons
(iii) Creative Commons (iv) Creative Common
17. Assertion (A): MODEM stands for modulator-demodulator.
Reasoning (R): It is a computer hardware device that converts data from a digital format to
analog and vice versa. [1]
(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

100 E
CBSE

18. Assertion (A): To use the Pandas library in a Python program, one must import it.
Reasoning (R): The only alias name that can be used with the Pandas library is pd. [1]
(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

SECTION-B
19. Briefly explain the basic concepts of a web server and web hosting. [2]
OR
Rati is doing a course in networking. She is unable to understand the concept of URL. Help her
by explaining it with the help of suitable example.
20. The python code written below has syntactical errors. Rewrite the correct code and underline the
corrections made. [2]
Import pandas as pd
df ={"Technology":["Programming","Robotics","3D Printing"],"Time(in months)":[4,4,3]}
df= Pd.dataframe(df)
Print(df)
21. Consider the given SQL string: [2]
“12#All the Best!”
Write suitable SQL queries for the following:
i. Returns the position of the first occurrence of the substring “the” in the given string.
ii. To extract last five characters from the string.
22. Predict the output of the given Python code: [2]
import pandas as pd
list1=[–10,–20,–30]
ser = pd.Series(list1*2)
print(ser)
23. Differentiate between the active digital footprint and passive digital footprints. [2]
24. Complete the given Python code to get the required output as: Rajasthan [2]
import _________ as pd
di = {'Corbett': 'Uttarakhand', 'Sariska':
'Rajasthan', 'Kanha': 'Madhya Pradesh’,
'Gir':'Gujarat'}
NP = ___________. Series( _____ )
print(NP[ ___________ ])
25. What are aggregate functions in SQL? Name any two. [2]

E 101
XII CBSE / Informatics Practices

SECTION-C
26. Based on the SQL table CAR_SALES, write suitable queries for the following: [3]
NUMBER SEGMENT FUEL QT1 QT2
1 Compact HatchBack Petrol 56000 70000
2 Compact HatchBack Diesel 34000 40000
3 MUV Petrol 33000 35000
4 MUV Diesel 14000 15000
5 SUV Petrol 27000 54000
6 SUV Diesel 18000 30000
7 Sedan Petrol 8000 10000
8 Sedan Diesel 1000 5000

i. Display fuel wise average sales in the first quarter.


ii. Display segment wise highest sales in the second quarter.
iii. Display the records in the descending order of sales in the second quarter.
OR
Predict the output of the following queries based on the table CAR_SALES given above:
i. SELECT LEFT(SEGMENT,2) FROM CAR_SALES WHERE FUEL= "PETROL";
ii. SELECT (QT2-QT1)/2 "AVG SALE" FROM CAR_SALES WHERE SEGMENT= "SUV";
iii. SELECT SUM(QT1) "TOT SALE" FROM CAR_SALES WHERE FUEL= "DIESEL";
27. Create a DataFrame in Python from the given list: [3]
[[‘Divya’,’HR’,95000],[‘Mamta’,’Marketing’,97000],[‘Payal’,’IT’,980000],
[‘Deepak’,’Sales’,79000]]
Also give appropriate column headings as shown below:

28. Write MySQL statements for the following: [3]


i. To create a database named FOOD.
ii. To create a table named Nutrients based on the following specification:
Column Name Data Type Constraints
Food_Item Varchar(20) Primary Key
Calorie Integer

102 E
CBSE

29. Richa, recently started using her social media account. Within a few days, she befriends many
people she knows and some that she does not know. After some time, she starts getting negative
comments on her posts. She also finds that her pictures are being shared online without her
permission. [3]
Based on the given information, answer the questions given below.
i. Identify the type of cybercrime she is a victim of.
ii. Under which act, she can lodge a complaint to the relevant authorities?
iii. Suggest her any two precautionary measures which she should take in future while
being online to avoid any such situations.
OR
Mention any three health hazards associated with inappropriate and excessive use of gadgets.
30. Consider the given DataFrame ‘Genre’: [3]
Type Code
0 Fiction F
1 Non Fiction NF
2 Drama D
3 Poetry P
Write suitable Python statements for the following:
i. Add a column called Num_Copies with the following data: [300,290,450,760].
ii. Add a new genre of type ‘Folk Tale' having code as “FT” and 600 number of copies.
iii. Rename the column ‘Code’ to ‘Book_Code’.

SECTION-D
31. Preeti manages database in a blockchain start-up. For business purposes, she created a table
named BLOCKCHAIN. Assist her by writing the following queries: [4]
TABLE: BLOCKCHAIN

i. Write a query to display the year of oldest transaction.


ii. Write a query to display the month of most recent transaction.
iii. Write a query to display all the transactions done in the month of May.
iv. Write a query to count total number of transactions in the year 2022.

E 103
XII CBSE / Informatics Practices

32. Ekam, a Data Analyst with a multinational brand has designed the DataFrame df that contains the
four quarter’s sales data of different stores as shown below: [4]
Store Qtr1 Qtr2 Qtr3 Qtr4
0 Store1 300 240 450 230
1 Store2 350 340 403 210
2 Store3 250 180 145 160
Answer the following questions:
i. Predict the output of the following python statement:
a. print(df.size)
b. print(df[1:3])
ii. Delete the last row from the DataFrame.
iii. Write Python statement to add a new column Total_Sales which is the addition of all the 4
quarter sales.
OR
(Option for part iii only)
Write Python statement to export the DataFrame to a CSV file named data.csv stored at D: drive.

SECTION-E
33. Write suitable SQL queries for the following: [5]
i. To calculate the exponent for 3 raised to the power of 4.
ii. To display current date and time.
iii. To round off the value -34.4567 to 2 decimal place.
iv. To remove all the probable leading and trailing spaces from the column userid of the table
named user.
v. To display the length of the string ‘FIFA World Cup’.
OR
Kabir has created following table named exam:
RegNo Name Subject Marks
1 Sanya Computer Science 98
2 Sanchay IP 100
3 Vinesh CS 90
4 Sneha IP 99
5 Akshita IP 100

Help him 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.

104 E
CBSE

34. XYZ Media house campus is in Delhi and has 4 blocks named Z1, Z2, Z3 and Z4. The tables
given below show the distance between different blocks and the number of computers in each
block. [5]

The company is planning to form a network by joining these blocks.


i. Out of the four blocks on campus, suggest the location of the server that will provide the
best connectivity. Explain your response.
ii. For very fast and efficient connections between various blocks within the campus, suggest
a suitable topology and draw the same.
iii. Suggest the placement of the following devices with justification
(a) Repeater
(b) Hub/Switch
iv. VoIP technology is to be used which allows one to make voice calls using a broadband
internet connection. Expand the term VoIP.
v. The XYZ Media House intends to link its Mumbai and Delhi centers. Out of LAN, MAN,
or WAN, what kind of network will be created? Justify your answer.
35. The heights of 10 students of eighth grade are given below: [5]
Height_cms=[145,141,142,142,143,144,141,140,143,144]
Write suitable Python code to generate a histogram based on the given data, along with an
appropriate chart title and both axis labels. Also give suitable python statement to save this chart.
OR

E 105
XII CBSE / Informatics Practices

Write suitable Python code to create 'Favourite Hobby' Bar Chart as shown below:

Also give suitable python statement to save this chart.

106 E
CBSE

MARKING SCHEME
IP SOLUTION SAMPLE QUESTION PAPER
CLASS XII (2023-24)
INFORMATICS PRACTICES (065)
SECTION-A
1. iii. Gateway [1]
(1 mark for correct answer)
2. ii. Beryllium [1]
(1 mark for correct answer)
3. i. Intellectual Property Right [1]
(1 mark for correct answer)
4. iv. NULL [1]
(1 mark for correct answer)
5. iii. LENGTH () [1]
(1 mark for correct answer)
6. iii. Google Chrome [1]
(1 mark for correct answer)
7. iii. Comma Separated Value [1]
(1 mark for correct answer)
8. iv. SELECT DEPT, AVG(SAL) FROM EMP GROUP BY DEPT [1]
HAVING COUNT(*) > 5;
(1 mark for correct answer)
9. iv. march [1]
(1 mark for correct answer)
10. ii. NP.tail(3) [1]
(1 mark for correct answer)
11. iv. Month [1]
(1 mark for correct answer)
12. iii. NaN [1]
(1 mark for correct answer)
13. iv. Ransomware [1]
(1 mark for correct answer)
14. iii. UPPER( ) [1]
(1 mark for correct answer)
15. i. Website [1]
(1 mark for correct answer)
16. iii. Creative Commons [1]
(1 mark for correct answer)

E 107
XII CBSE / Informatics Practices

17. i. Both A and R are true and R is the correct explanation for A [1]
(1 mark for correct answer)
18. iii. A is True but R is False [1]
(1 mark for correct answer)

SECTION-B
19. Web server: A web server is used to store and deliver the contents of a website to clients such as
a browser that request it. A web server can be software or hardware.
Web hosting: It is a service that allows to put a website or a web page onto the Internet, and make
it a part of the World Wide Web. [2]
(1 mark each for each correct explanation)
OR
URL: It stands for Uniform Resource Locator. It provides the location and mechanism (protocol)
to access the resources over the internet.

URL is sometimes also called a web address. It not only contains the domain name, but other
information as well that completes a web address.
Examples:
https://www.cbse.nic.in, https://www.mhrd.gov.in, http://www.ncert.nic.in,
http://www.airindia.in, etc.
(1 mark for correct explanation)
(1 mark for correct example)
20. import pandas as pd [2]
df ={"Technology" : ["Programming","Robotics","3D Printing"],"Time(in months)" : [4,4,3]}
df= pd.DataFrame(df)
print(df)
(1/2 mark for each correction)
21. i. SELECT INSTR ("12#All the Best!","the"); [2]
ii. SELECT RIGHT ("12#All the Best!",5);
(1 mark for each correct query)
22. 0 -10 [2]
1 -20
2 -30
3 -10
4 -20
5 -30
(2 marks for correct output)
23. Active Digital Footprints: Active digital footprints include data that we intentionally submit
online. This would include emails we write, or responses or posts we make on different websites
or mobile Apps, etc.
Passive Digital Footprints: The digital data trail we leave online unintentionally is called
passive digital footprints. This includes the data generated when we visit a website, use a mobile
App, browse Internet, etc. [2]
(2 marks for correct differentiation)

108 E
CBSE

24. import pandas as pd [2]
di = {'Corbett': 'Uttarakhand', 'Sariska':'Rajasthan', 'Kanha': 'Madhya Pradesh','Gir':'Gujarat'}
NP = pd.Series(di)
print(NP['Sariska'])
(1/2 mark for each correct fill-up)
25. Aggregate functions: These are also called multiple row functions. These functions work on a
set of records as a whole, and return a single value for each column of the records on which the
function is applied. [2]
Max(), Min(), Avg(), Sum(), Count() and Count(*) are few examples of multiple row functions.
(1 mark for correct explanation)
(½ mark each for two correct names)

SECTION-C
26. i. SELECT FUEL, AVG(QT1) FROM CAR_SALES GROUP BY FUEL;
ii. SELECT SEGMENT, MAX(QT2) FROM CAR_SALES GROUP BY SEGMENT;
iii. SELECT * FROM CAR_SALES ORDER BY QT2 DESC;
(1 mark for each correct query)
OR
i.
+--------------------------+
| LEFT(SEGMENT, 2) |
+--------------------------+
| Co |
| MU |
| SU |
| Se |
+--------------------------+
ii.
+-------------------+
| AVG SALE |
+-------------------+
| 13500.0000 |
| 6000.0000 |
+-------------------+
iii.
+---------------+
| TOT SALE |
+---------------+
| 67000 |
+---------------+
(1 mark each correct output)

E 109
XII CBSE / Informatics Practices

27. import pandas as pd #Statement 1 [3]
df=[["Divya","HR",95000],["Mamta","Marketing",
97000],["Payal","IT",980000], ["Deepak","Sales",79000]] #Statement 2
df=pd.DataFrame(df,columns=["Name","Department", "Salary"]) #Statement 3
print(df) #Statement 4
(#Statement 1 & 4 – ½ mark each)
(#Statement 2 & 3 – 1 mark each)
28. i. CREATE DATABASE FOOD; [3]
(1 mark for correct answer)
ii.CREATE TABLE NUTRIENTS(NAME VARCHAR(20) PRIMARY KEY,CALORIES
INTEGER);
(½ mark for CREATE TABLE NUTRIENTS
½ mark each for correctly specifying each column
½ mark for correctly specifying primary key)
29. i. She is a victim of Cyber Bullying. [3]
ii. Information Technology Act, 2000 (also known as IT Act).
iii. a. Need to be careful while befriending unknown people on the internet.
b. Never share personal credentials like username and password with others.
(1 mark for each correct answer)
OR
Simran needs to be made aware of the following consequences:
i) Eye strain ii) Painful muscles and joints iii) Poor memory
iv) Lack of sleep v) Back pain and neck pain
(1 mark each for writing any 3 correct health hazards)
30. i. Genre["Num_Copies"] = [300,290,450,760] [3]
ii. Genre.loc[4]=["Folk Tale","FT",600]
iii. Genre=Genre.rename({"Code":"Book_Code"}, axis=1)
OR
Genre=Genre.rename({"Code":"Book_Code"}, axis="columns")
(1 mark for each correct statement)

SECTION-D
31. i. SELECT YEAR (MIN (TRANSACTION_DATE)) FROM BLOCKCHAIN; [4]
ii. SELECT MONTH (MAX (TRANSACTION_DATE)) FROM BLOCKCHAIN;
iii. SELECT * FROM BLOCKCHAIN WHERE MONTHNAME
(TRANSACTION_DATE)='MAY';
iv. SELECT COUNT(ID) FROM BLOCKCHAIN WHERE
YEAR (TRANSACTION_DATE)=2022;
(1 mark for each correct query)

110 E
CBSE

32. i. a. 15 [4]
b. Store Qtr1 Qtr2 Qtr3 Qtr4
1 Store2 350 340 403 210
2 Store3 250 180 145 160
ii. df=df.drop(2)
OR
df.drop(2,axis=0)
iii. df["total"]=df["Qtr1"]+df["Qtr2"]+df["Qtr3"]+df["Qtr4"]
OR
df.to_csv(“D:\data.csv”)
(1 mark for each correct output/statement)
SECTION-E
33. i. SELECT POWER(3,4); [5]
ii. SELECT NOW();
iii. SELECT ROUND(-34.4567,2);
iv. SELECT TRIM(USERID) FROM USER;
v. SELECT LENGTH("FIFA World Cup");
(1 mark for each correct query)
OR
Ans: i. INSERT INTO EXAM VALUES(6,'Khushi','CS',85);
ii. UPDATE EXAM SET subject= "Informatics Practices" where subject = "IP";
iii. DELETE FROM EXAM WHERE marks<30;
iv. ALTER TABLE EXAM ADD COLUMN grade varchar (2);
v. Select * from exam where subject="Informatics Practices";
(1 mark for each correct query)
34. i. Z2 as it has maximum number of computers. [5]
ii. For very fast and efficient connections between various blocks within the campus suitable
topology: Star Topology

E 111
XII CBSE / Informatics Practices

iii. Repeater: To be placed between Block Z2 to Z4 as distance between them is more than 100
metres.
Hub/Switch: To be placed in each block as each block has many computers that needs to be
included to form a network.
iv. Voice Over Internet Protocol
v. WAN as distance between Delhi and Mumbai is more than 40kms.
(1 mark for each correct answer)
35. import matplotlib.pyplot as plt #Statement 1 [5]
Height_cms=[145,141,142,142,143,143,141,140,143,144]
#Statement 2
plt.hist(Height_cms) #Statement 3
plt.title("Height Chart") #Statement 4
plt.xlabel("Height in cms") #Statement 5
plt.ylabel("Number of people") #Statement 6
plt.show() #Statement 7
(½ mark each for each correct statement 1,2,4,5,6,7)
(1 mark for correct statement 3)

plt.savefig("heights.jpg")
(1 mark for the correct statement)
OR

import matplotlib.pyplot as plt #Statement 1


hobby = ('Dance', 'Music', 'Painting', 'Playing
Sports') #Statement 2
users = [300,400,100,500] #Statement 3
plt.bar(hobby, users) #Statement 4
plt.title("Favourite Hobby") #Statement 5
plt.ylabel("Number of people") #Statement 6
plt.xlabel("Hobbies") #Statement 7
plt.show() #Statement 8
(½ mark for each correct statement)
plt.savefig("hobbies.jpg")
(1 mark for the correct statement)

112 E
CBSE


CBSE PAPER-2024 (SET-4_90)


INFORMATICS PRACTICES
Time : 3 Hrs. Max. Marks : 70

General Instructions :
(i) This question paper contains five sections, Section A to E.
(ii) All questions are compulsory.
(iii) Section A has 18 questions carrying 1 mark each.
(iv) Section B has 7 Very Short Answer type questions carrying 2 marks each.
(v) Section C has 5 Short Answer type questions carrying 3 marks each.
(vi) Section D has 2 questions carrying 4 marks each.
(vii) Section E has 3 questions carrying 5 marks each.
(viii) All programming question are to be answered using Python language only.

SECTION – A
1. In___topology, the devices are arranged in the form of multiple branches in hierarchical manner.
(i) Star (ii) Tree (iii) Mesh (iv) Bus [1]
2. Ridhima purchased a license for a copy of a software and made additional copies without the
permission of the copyright owner. This act of hers is known as_______. [1]
(i) Trademark Infringement (ii) Identity Theft
(iii) Copyright Infringement (iv) Patent
3. What can an individual do to enhance the privacy of data stored digitally ?
(i) Share sensitive information on social media platforms.
(ii) Use your date of birth as your password.
(iii) Regularly update software installed on your device,
(iv) Download and install software from unknown sources.
4. What will be the output of the following query ? [1]
SELECT POWER(2,MOD(17,3));
(i) 8 (ii) 1 (iii) 0 (iv) 4
5. Which of the following is not an aggregate function in MYSQL? [1]
(i) AVG() (ii) MAX() (iii) LCASE() (iv) MIN()
6. _____ is the gaining of unauthorized access to data in a computer system. [1]
(i) Phishing (ii) Plagiarism (iii) Hacking (iv) Copyright violation
7. Which of the following is NOT true with respect to CSV files ? [1]
(i) Values are separated by commas.
(ii) to_csv() can be used to save a dataframe to a CSV file.
(iii) CSV file is created using a word processor.
(iv) CSV file is a type of text file.

E 113
XII CBSE / Informatics Practices

8. Which MySQL command helps to add a primary key constraint to any table that has already been
created? [1]
(i) UPDATE (ii) INSERT INTO (iii) ALTER TABLE (iv) ORDER BY
9. What will be the output of the following query ? [1]
SELECT SUBSTR ("G20 2023 INDIA",5,4);
(i) G20 2 (ii) 2023 (iii) INDI (iv) 023
10. What will be the output of the following Python code ?
import pandas as pd
dd={'One' : 1, 'Two' : 2, 'Three' : 3, 'Seven' : 7}
rr=pd.series (dd)
rr['Four']=4
print(rr)
(i) One 1
Two 2
Three 3
Seven 7
dtype: int64
(ii) One 1
Two 2
Three 3
Four 4
Seven 7
dtype: int64
(iii) Four 4
One 1
Two 2
Three 3
Seven 7
dtype: int64
(iv) One 1
Two 2
Three 3
Seven 7
Four 4
dtype: int64
11. Which of the following clause cannot work with SELECT statement MYSQL? [1]
(i) FROM (ii) INSERT INTO (iii) WHERE (iv) GROUP BY
12. Which of the following command will not show first five rows from the Pandas series
named S1? [1]
(i) Sl[0:5] (ii) Sl.head () (iii) Sl.head(5) (iv) Sl.head[0:5]

114 E
CBSE

13. Rama was unable to understand how the recruiters were able to know about her digital
activity when she has not shared anything with them. The recruiters might have checked_____of
Rama. [1]
(i) Carbon Footprint (ii) Water Footprint
(iii) Online print (iv) Digital Footprint
14. Which MySQL string function is used to extract a substring from a given string based on a
specified starting position and length ? [1]
(i) SUBSTRING_INDEX() (ii) LENGTH()
(iii) MID() (iv) TRIM()
15. The software that is free for anyone, and its source code is available for access, modification,
correction, and improvement is called_________.
(i) Proprietary software (ii) Commercial software
(iii) Free and Open source software (iv) Copyrighted software
16. _______ help in data protection through copyrights, patents and trademarks. [1]
(i) Data Privacy Right (ii) Right to Innovation
(iii) Intellectual Property Rights (IPR) (iv) Right to Data Protection
17. Assertion (A) : Cyber Bullying can have serious, emotional and psychological effects on
victims. [1]
Reason (R) : Online Bullying is not a crime while offline bullying is a crime.
(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 and (R) is false.
(iv) (A) is false but (R) is true.
18. Assertion (A) : A Series is a one dimensional array and a DataFrame is a two-dimensional array
containing sequence of values of any data type, (int, float, list, string, etc.)
Reason (R) : Both Series and DataFrames have by default numeric indexes starting from zero.
(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 and (R) is false.
(iv) (A) is false but (R) is true.

SECTION – B
19. Expand URL. Identify the protocol and domain in the following URL : [2]
https: //epathshala.nic.in/topics. php?len=en
OR
Write any one advantage and one disadvantage of Star topology.
20. The Python code written below has syntactical errors. Rewrite the correct code and underline the
correction(s) made. [2]
import Pandas as pd
stud=['Name' : Ramya'1, 'Class' :110, 'House' : Red']
S=p.eries(s)
print(s)

E 115
XII CBSE / Informatics Practices

21. What will be the output of the following SQL queries : [2]
(i) SELECT RIGHT ("CHANDRAYAN3",4);
(ii) SELECT ROUND (76345.456,2);
22. Find the output of the following Python code : [2]
import pandas as pd
com=pd.Series ([45, 12, 15, 200], index=['mouse','printer',webcam',keyboard'])
print(com[1:3])
23. What is the primary function of a gateway in a computer network ? Explain briefly. [2]
24. Consider the following Python code : [2]
import pandas as pd
S1=pd.series (['Rubina','Jaya','Vaibhav'], index=[10,16,18])
S2=pd.series (_______, index=[10, 16, 18])
S3=pd.series (156,67,86], _________)
xiia ={'Name' : _______, 'Subject' : s2, 'Marks' : s3}
df=pd.DataFrama (________)
print(df)
Complete the above Python code to display the following output:
Name Subject Marks
10 Rubina IP 56
16 Jaya HSc 67
18 Vaibhav IP 86
25. Write any two differences between UPDATE and ALTER TABLE commands of MySQL. [2]

SECTION – C
26. (a) Consider the given table and write the following queries in MySQL :
Table : Sports
Sid SName Fees Date of Play Coachid
1 Karate 1200 2024-08-24 S1
2 Football 1800 2024-09-13 S2
3 Cricket 1500 2024-06-14 S3
4 Lawn Tennis 2500 2024-09-25 S4
5 Badminton 1800 2024-10-20 S5
(i) To display Sid and name of those sports which are to be Played in the month of
September.
116 E
CBSE

(ii) To display all Sports names in lower case.
(iii) To display last two characters of all sports names whose fees is less than 1500.
OR
(b) Predict the output of the following queries based on the table Sports given above :
(i) SELECT UCASE (TRIM (SName)) FROM Sports WHERE Sid=5;
(ii) SELECT LEFT (SName,3)FROM Sports WHERE DateofPlay> "2024-09-13";
(iii) SELECT SUBSTR (Coachld, 1) FROM Sports WHERE SName="Cricket"
or Fees>=2000;
27. Kabir, a data analyst, has stored the voter's name and age in a dictionary. Now, Kabir wants to
create a list of dictionaries to store data of multiple voters. He also wants to create a DataFrame
from the same list of dictionaries having appropriate row labels as shown below ;
Voter_Name Voter_Age
Arl00l Arjun 35
Ba3002 Bala 23
Go4002 Govind 25
Dh4007 Dhruv 19
Na6005 Navya 18
Help Kabir in writing a Python program to complete the task.
28. Answer the following questions based on the table Salesman given below :
salesman_id name city commission

5001 Neil Bhatt Delhi 0.15

5002 Rohan Malik Mumbai 0.13

5005 Ravi Mohan Delhi 0.11

5006 Mehak Rai Delhi 0.14

5007 Paul Lal Bangalore 0.13

5003 Raman Sen Kolkata 0.12

(i) How many tuples does not given table have?


(ii) Suggest the primary key for the given table.
(iii) Write the MySQL query to display all the records in descending order of commission.
29. (a) Police officials arrested four members of an interstate gang for allegedly duping many
people from different states on the pretext of providing them with holiday packages after
creating fake websites of tours and Travels. The cyber criminals sent fraudulent emails
containing links to fraudulent websites created by them.
The victim in his complaint told police that he was offered a holiday package to Dubai for a
total of 10 times in the next 10 years and was charged Rs. 1.45 lakh through his credit card.

E 117
XII CBSE / Informatics Practices

Answer the following questions pertaining to the given new byte :
(i) Identify the type of cybercrime mentioned in above case.
(ii) Which Act deals with such crimes in India ?
(iii) Suggest any one precaution that can be taken to avoid falling prey to such criminals.
OR
(b) ABC Electronics, a popular electronics retail chain, has been a prominent player in the
market for years. However, recent concerns over environmental degradation and e-waste
have prompted the company to rethink its strategies and practices. As the newly appointed
sustainability manger, you've been asked to answer the following questions :
(i) Considering the environmental concerns associated with e-waste, outline any one
negative impact of the electronic products on the environment.
(ii) Gopal is a college student who recently bought his new smartphone from ABC
electronics. He's excited about the new features and improved performance of his new
device. However, he's now left with his old smartphone, which is still functional but
considered outdated. Suggest him any one action that he can take for his old
smartphone.
(iii) Provide any one recommendation on how ABC Electronics can responsibly manage
its e-waste while minimizing harm to the environment.

30. Consider the given DataFrame 'password' :


CodeName Category Frequency

0 aaaaaa alpha 6.91

1 dragon animal 18.52

2 baseball sport 1.29

3 football sport 11.11

4 monkey animal 3.72

5 qwerty alpha 1.85

6 abcde alpha 3.19


Write suitable Python statements for the following :
(i) To add a new row with following values :
CodeName – 'abcl23'
Category – alphanumeric
Frequency – 12.8
(ii) To delete the row with the row label 2.
(iii) To delete the column having column label as Frequency.

118 E
CBSE

SECTION – D
31. Rupam created a MySQL table to store the details of Nobel prize winner. Help her to write the
following MySQL queries :
TABLE : NOBEL
Winner_Id YEAR SUBJECT WINNER COUNTRY CATEGORY

1001 1970 Physics Hannes Alfven Sweden Scientist

1002 1970 Physiology Bernard Katz NULL Scientist

1003 1970 Literature Aleksandr Solzhenitsyn Russia Linguist

1004 1971 Chemistry Gerhard Herzberg Germany Scientist

1005 1978 Peace Menachem Begin Israel Prime Minister

1006 1987 Economics Robert Solow USA Economist

1007 1994 Literature Kenzaburo Oe Japan Linguist


(i) Display the names of Nobel Prize winner in 'Literature for the year 1970.
(ii) Display the subject and category of winners whoso country is not known.
(iii) Display the details of all Nobel Prize winners who wore Scientists,
(iv) Count total number of winners whose subject is Literature.
32. Ms. Ritika conducted an online assessment and stored the details in DataFrame result as given below :
Name Score Attempts Qualify
a Atulya 12.5 1 yes
b Disha 9.0 3 no
c Kavita 16.5 2 yes
d John 15.0 1 no
Answer the following questions :
(i) Predict the output of the following Python statement:
print(result.loc[:,Attempts'] > 1)
(ii) Write the Python statement to display the last three records.
(iii) Write Python statement to display records of 'a' and 'd' row labels.
OR
(Option for Part (iii) only)
(iii) Write suitable Python statement to retrieve the data stored in file, 'registration.csv'
into a DataFrame, 'regis'.

E 119
XII CBSE / Informatics Practices

SECTION – E
33. Excellent Consultancy Pvt. Ltd. maintains two tables for all its employees.
Table : Employee
Employee_id First, Last_ Salary Joining_ Department
name name date
E101 Monika Das 100000 2019-01-20 Finance
E102 Mehek Verma 600000 2019-01-15 IT
E103 Manan Pant 890000 2019-02-05 Banking
E104 Shiva m Agarwal 200000 2019-02-25 Insurance
E105 Alisha Singh 220000 2019-02-28 Finance
E106 Poonam Sharma 400000 2019-05-10 IT
E107 Anshunaan Mishra 123000 2019-06-20 Banking

Table : Reward
Employee_id Date_reward Amount
E101 2019-05-11 1000
E102 2019-02-15 5000
E103 2019-04-22 2000
E106 2019-06-20 8000
Write suitable SQL queries to perform the following task:
(i) Change the Department of Shivam to IT in the table Employee.
(ii) Remove the record of Alisha from the table Employee.
(iii) Add a new column Experience of integer type in the table Employee.
(iv) Display the first name, last name and amount of reward for all employees from the tables
Employee and Reward.
(v) Display first name and salary of all the employees whose amount is less than 2000 from the
tables Employee and Reward.
OR
Write suitable SQL queries for the following task:
(i) Display the year of joining of all the employees from the table Employee.
(ii) Display each department name and its corresponding average salary.
(iii) Display the first name and date of reward of those employees who joined on Monday from
the tables Employee and Reward.
(iv) Display sum of salary of those employees whose reward amount is greater than 3000 from
the tables Employee and Reward.
(v) Remove the table Reward.

120 E
CBSE

34. FULLMAN Tech, Bengah.ru is a company that dea Is with software development. They have
different divisions HR (H1), Sales (H2) Production (H3) and Marketing (H4). The layout of the
Bengaluru branch

HR Sales
(H1) (H2)

Production Marketing
(H3) (H4)

The management wants to connect all the divisions as well as all the computers of each division
(HI, H2, H3 and H4).
Distance between the divisions are as follows :
H1 to H2 76 m
H1 to H3 185 m
H1 to H4 88 m
H2 to H3 140 m
H2 to H4 125 m
H3 to H4 160 m
Number of computers in each of the division :
Division Number of Computers
HI 140
H2 340
H3 180
H4 260
Based on the above specifications, answer the following questions :
(i) Suggest the topology and draw the most efficient cable layout for connecting all the
divisions of Bengaluru branch.
(ii) FULLMAN Tech is expanding its reach and therefore it establishes a new office in Delhi.
Out of LAN, MAN, and WAN what kind o network will be created to connect Bengaluru
office with Delhi Office?
(iii) Suggest the division for the placement of branch. Explain the reason for your selection
Bengaluru branch. Explain the reason for your selection.
(iv) Suggest the placement of the following devices in Bengaluru branch :
(a) Repeater
(b) Switch/Hub
(v) The company's manager Ms. Ritu is worried as to how she can extend and modify the
functionality of the web browser. Help her by giving names of any two tools.

E 121
XII CBSE / Informatics Practices

35. (a) The inventory management software of a grocery shop stores the price of all fruits as
follows :
Fruits=['Apple','Guava','Papaya','Grapes','Mango']
Price=[150,70,50,30,120]
Write suitable Python code to generate a Bar Chart on the given data. Also add the chart
title and label for X and Y axis. Also add suitable statement to save this chart with the
name fruit.png.
OR
(b) Write suitable Python code to draw the following line chart "CO2 Emission" having title
and label for X and Y axis as shown below.
Month wise CO2 emission
60
55
Percentage →

50
45
40
35
30
25
20

April May June July August


Month →
Also give suitable Python statement to save this chart with the name, emission.png.

122 E
CBSE


CBSE PAPER-2024 (SET-4_90)


SOLUTION
SECTION – A
1. (ii) Tree
2. (iii) Copyright Infringement
3. (iii) Regularly updata software installed on your device.
4. (iv) 4
5. (iii) LCASE ()
6. (iii) Hacking
7. (iii) CSV file is created using a word processor.
8. (iii) ALTER TABLE
9. (iv) One 1, Two 2, Three 3, Seven 7, Four 4, dtype : int64
11. (ii) INSERT INTO
12. (iii) S1.head (5)
13. (iv) Digital Foot print
14. (iv) MID()
15. (iii) Tree and open source software
16. (iii) Intellectual property Rights (IPR)
17. (iii) (A) is true and (R) is false.
18. (ii) Both (A) and (R) are true and (R) is not the correct explanation for (A).
SECTION – B
19. (i) Protocol - https
(a) (ii) domain - epathshala.nic.in
(b) Advantage - star topology is connected very effective, efficient and fast as each device is
directly connected with the central device.
Disadvantage - Any failure in the central networking device may lead to the failure of
complete network.
20. import pandus as pd
stud={'Name, 'Ramya', 'Class' : II, 'House': 'Red'}
s=pd.series (stud)
print(s)
21. (i) YAN 3
(ii) 76345.46
22. printer 12
webcam 15
dtype : int 64

E 123
XII CBSE / Informatics Practices

23. A gateway is a device that connects the organisation's network with the outside world of the
internet. Gateway serves as the entry and exit point of a network, as all data coming in or going
out of a network must first pass through the gateway in order to use routing paths. Besides
routing data packets gateways also maintain information about the host network's internal
connection paths and the identified paths of other remote networks.
For simple internet connectivity at homes. The gateway is usually the internet service provider
provide access to the entire internet.
24. S2 = pd.series (['IP', 'HSc', ''IP'], index = [10,16,18]
S3 = pd.series ([56,67,86], index = [10,16,18]
xiia = {'Name' : S1, 'Subject' : 52, 'Marks' : 53}
df = pd.Data frame (xiia)
25. UPDATE ALTERTABLE
1. UPDATE is a DML command 1. ALTER TABLE is a DDL command
2. UPDATE command in used to change 2. ALTER TABLE command is used to
the values type or column. modify the structure of a table.
SECTION – C
26. (a)
(i) SELECT Sid, SName FROM sports WHERE
month (date of play) = 9;
(ii) SELECT case (SName) FROM Sports;
(iii) SELECT right (SName, 2) FROM Sports WHERE
fees < 15000;
OR
LEFT (SName, 3) SUBSTR (Coachid, 1)
UCASE (TRIM (SName))
26. (b) (i) (ii) (iii) S3
BADMINTON LAW
S4
BAD
27. import pandas as pd
Voters = [{'Voter_Name' : 'Arjun','Voter_Age' : 35}
{'Voter_Name' : 'Bala', 'Voter_Age' : 233}
{'Voter_Name' : 'Govind, 'Voter_Age' : 25}
{'Voter_Name' : Dhruv', 'Voter_Age' : 19}
{'Voter_Name' : Navya, 'Voter_Age' : 18}
rowindex = ['Arl00l'. 'Ba3002', 'GO4002', 'Db4007', 'Na6005']
df = pd. Data frame (Voters, index = rowindex)
print (df)
28. (i) Number of tuples : 6
(ii) Primary key: salesman_id
(iii) SELECT & From salesman ORDER By commission 0ESe;
29. (a) (i) Phishing
(ii) IT Act 2000/IT Act 2008
(iii) We should ensure to open any email link or attachment only when it is from a trusted
source and desnot't look doubt ful.

124 E
CBSE

OR
29. (b) (i) When e-waste is carelessly thrown or dumped in landfills or dumping grounds, certain
elements or metals used in production of electronic products cause air, water and soil
pollution.
(ii) He should denote or sold to someone who is still willing to use it. The process of re
selling old electronic goods at lower prices is called refurbishing.
(iii) ABC electronic needs to buy the old products and follow the feasible e-waste
management technique, i.e., reduce-reuse-cycle.
30. (i) password.loc [7] = ['abc 123; 'alphenumric', 12.8]
(ii) password = password.drop (2,axis=0)
(iii) password = password.drop ('Frequency, axis = 1)

SECTION – D
31. (i) SELECT WINNER FROM NOBEL WHERE SUBJECT
= 'Literature' and YEAR = 1970;
(ii) SELECT SUBJECT, CATEGORY FROM NOBEL
WHERE COUNTRY is NULL;
(iii) SELECT & FROM NOBEL WHERE CATEGORY = 'Scientist';
(iv) SELECT COUNT (*) FROM WHERE SUBJECT = 'Literature';
32. (i) a False
b True
c True
d False
(ii) result.tail (3)
(iii) result.loc (['a', 'd'])
OR
(iii) import pandas as pd
regis.pd, read_cv("registration,csv ",sep = ", ", header = 0)

SECTION – E
33. (i) UPDATE Employee SET Department = 'IT' WHERE
First_Name = 'Shivam';
(ii) DELETE FROM Employee WHERE First.Name = 'Alisha';
(iii) ALTER TABLE Employee ADD Experience INTEGER;
(iv) SELECT first_Name, Last_Name, Amount FROM Employee,
Reward WHERE Employee. Employee_id = Reward.Employee_id;
(v) SELECT first_Name, Salary FROM Emplyee, Reward
WHERE Employee. Employee_id= Reward.Employee_id
AND Amount < 2000;
OR
(i) SELECT YEAR (joining_date) FROM Employee;
(ii) SELECT Department, AVG (Salary) FROM Employee
GROUP By Department;
E 125
XII CBSE / Informatics Practices

(iii) SELECT First Name, Date_reward FROM Employee, Reward WHERE Employee
Employee_id = Reward.
Employee_id AND DAYNAME (Joining_Date) = 'Monday';
(iv) SELECT SUM (Salary) FROM Employee, Reward WHERE Employee. Employee_id
= Reward Employee_id AND Amount > 3000;
(v) DROP TABLE Reward;
34. Topology :
Most efficient cable layout

H2 140M H3
76M

H1
88M

H4

(ii) WAN
(iii) Placement of server = H2
Reason : Because at H2, number of computers are more than other division.
(iv) (a) Repeater : Between H2 and H3, because distance is more then 100 m.
(b) Switch/Hub : At every division, because humber of computer at every division is more
than 100 m.
(v) Add-ons oil plug-ins are the tools that help to extend at modify the functionality of the
browser.
35. (a) import mat plotlib. pyplot as plt
fruits = ['Apple', 'Guava', 'Papaya', Grapes','Mango']
Price = [150, 70, 50, 30, 120]
plt.bar [fruits, Price]
plt. x label ('fruits')
plt.y label ('Price')
ptt.title ("fruit price comparism")
plt. save fig ("fruits.png")
plt. show()
OR
(b) import_matplotlib. pyplot as plt
month = ['April', 'May', 'June', 'July', 'August']
data = [40,50,30,60,20]
plt.plot (Month, data)
plt.xlabel ('Month ---->')
plt.ylabel ('Percentage---->')
plt.title ("Monthwise CO2 emission")
plt.savefig.("emission.png")
plt.show()

126 E

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy