SSM Xii Informatics Practices
SSM Xii Informatics Practices
CHIEF MENTOR
Smt. Sona Seth, Deputy Commissioner, KVS Regional Office Lucknow
MENTOR
Sh. Anup Kumar Awasthi, Assistant Commissioner, KVS Regional Office Lucknow
Smt. Archana Jaiswal, Assistant Commissioner, KVS Regional Office Lucknow
Sh. Vijay Kumar, Assistant Commissioner, KVS Regional Office Lucknow
COORDINATOR
Sh. Samrat Kohli, Vice-Principal, PM SHRI KV OEF No. 1 Kanpur
CONTENT DEVELOPMENT TEAM
Sh. Sunil Kumar Verma, PGT (Comp. Sc.), PM SHRI KV Armapur No. 1 Kanpur
Sh. Paritosh Srivastava, PGT (Comp. Sc.), PM SHRI KV AMC 1st Shift
Sh. Keshar Singh, PGT (Comp. Sc.), KV BHEL Jagdishpur
Sh. Nripendra Kumar, PGT (Comp. Sc.), KV No. 3 Chakeri Kanpur
Sh. Dharmendra Kumar Tripathi, PGT (Comp. Sc.), KV IIT Kanpur
Sh. Vivek Kumar Gupta, PGT (Comp. Sc.), PM SHRI KV MCF Lalganj Raebareli
Ms. Divya Agrawal, PGT (Comp. Sc.), PM SHRI KV Gomtinagar 2nd Shift Lucknow
IMPROVEMENT & COMPILATION
Sh. Ashok Kumar, PGT (Comp. Sc.), PM SHRI KV No. 2 Armapur Kanpur
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
2
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Index
Sl. No. Unit Name Chapter Name Marks in Page No
CBSE
1 Data Handling using Python Series 05 4-6
Pandas and data
Visualization
2 Data Handling using Python Dataframe 10 7-10
Pandas and data
Visualization
3 Data Handling using Data Visualization 05 11-14
Pandas and data
Visualization
4 Database Queries using Database Concept and 10 15-27
SQL MySQL simple Queries
5 Database Queries using MySQL Functions 10 28-36
SQL
6 Introduction to Computer Networking and 10 37-41
Computer Network web
7 Societal Impacts Societal Impacts 10 42-49
TOTAL 60
3
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Pandas:
• 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.
1. Series
2. Data Frame
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.
4
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
5
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Q.2- State whether True or False a. A series object is size mutable. (False)
a. A series object is size mutable. b. A Dataframe object is value mutable (True)
b. A Dataframe object is value mutable
6
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
DATA FRAMES
DataFrame is a Data Structure
It is two dimensional (tabular) heterogeneous data labeled array.
It has two indices or two axes : a row index (axis=0) and a column index (axis=1)
The row index is known as index and the column index is called the column name.
The indices can be of any data type.
It is both value mutable and size mutable.
We can perform arithmetic operations on rows and columns.
Creating DataFrame
1.Creating a DataFrame from dictionary of Series.
DataFrames are two dimensional representation of series.
smarks=pd.Series({'Neha':80,'Maya':90,'Reena':70})
sage=pd.Series({'Neha':25,'Maya':30,'Reena':29})
dict={'Marks':smarks,'Age':sage}
df3=pd.DataFrame(dict)
7
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Solved Questions
Q1. What is the purpose of index attribute in dataframe:
(a) Fetch the dimension of the given dataframe (b) Fetch the size of the given dataframe
(c) Fetch both index and column names of the given dataframe (d) Fetch the index’s name in the dataframe
Ans: (d)
Q2. What is the purpose of ndim attribute in dataframe:
(a) Fetch the dimension of the given dataframe (b) Fetch the size of the given dataframe
(c) Fetch both index and column names of the given dataframe
(d) Fetch the data type values of the items in the dataframe Ans: (a)
8
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
(d) Fetch the data type values of the items in the dataframe Ans : (b)
Q5. From the 6th display the 3rd, 4th and 5th columns from 6th to 9th rows of a dataframe DF, you can write ______.
(a) DF.loc[6:9,3:5] (b) DF.loc[6:10,3:6] (c) DF.iloc[6:10,3:6] (d) DF.iloc[6:9,3:5] Ans: (c)
Q6. To change the 5th column’s value at 3rd row as 35 in dataframe DF you can write ____.
(a) DF.loc[4,6]=35 (b) DF[3,5]=35 (c) Df.iat[4,6]=35 (d) Df.iat[3,5]=35 Ans: (d)
Q7. Which among the following options can be used to create a DataFrame in Pandas?
(a) A scalar value (b) An ndarray (c) A python (d) All of these Ans: (d)
9
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Sno4 54 89 56 56
Sno5 76 43 87 87
Q11. Write the purpose of loc
(a) loc is label-based, which means that you have to specify rows and columns based on their row and column labels.
(b) loc is integer position-based, so you have to specify rows and columns by their integer position values (0-based
integer position).
(c) Option (a) is correct
(d) Both (a) and (c)
Ans: (d)
10
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Introduction of Matplotlib –
Matplotlib is used to create charts in few lines of code. It is the most popular and a multi-
platform data visualization library built on NumPy arrays.
Understanding Pyplot-
The pyplot module of Matplotlib library can be imported in the Python program to plot graphs.
import matplotlib.pyplot as plt
Where plt is name given to pyplot object. You can give any valid identifier/name.
Similarly Use of Numpy and Pandas-
import Numpy as np and
import Pandas as pd
Here plt, np and pd are interfaces objects used during program development.
o plt.show() – It display current object or chart made using interactive windows. Chart
Attributes:-
o Adding Labels – Labels can be display on following axis-
x –axis
y- axis
o Title – It display the title of the chart
o Legends – It display types of patterns/ colour for different parts of the charts.
X-Value : Dataset for X-Axis. Default value is [0..N-1], if not given values for X-Axis.
(Dataset may be 1-D Array, List, Series or Column of DataFrame.)
Y-Value : Dataset for Y-Axis. Number of values for X-Axis and Y-Axis should be equal.
11
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Bar Graph –
It is plot using a rectangular bars shapes along with x axis – horizontally and y axis – vertically.
Histogram-
A histogram is graphical visualization of the distribution of numerical Data in terms of frequency count. It
represents frequencies as bars based on non-overlapping ranges called bins.
Bins can be considered as consecutive, non-overlapping intervals of ranges. If can be a number or range with
lower and upper limit.
Using hist() function we can plot and customize histogram like bins or ranges, histogram types and orientation etc.
Example-
# 1.Hitogram with 5 bins for age of students
import matplotlib.pyplot as plt
data=[2,4,5,6,2,6,8,10,12,12,11,
10,4,3,2,5,7,9,11,12,13,14,
15,14,10,9,7,9]
plt.hist(data,bins=5)
plt.show()
Saving Plot:
To save any plot use savefig(<file name>) ,File type may be .png, ,jpg, .svg or .pdf.
For eg.
plt.savefig ('myline.pdf')
12
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Q. 1 Matplotlib is a
Q.2 The first sequence given in the bar() function represents the
i. y-axis, ii. z-axis, iii. x-axis iv. Can’t determine
Q.4 Sachin has created the graph shows the sales of Maruti and hundai. Even he has written the legend
function but still legend are not visible on the canvas. Find out what sachin has to write to make the
legend visible on the canvas
i. legend(True), ii. label, iii. xlabel & iv. ylabel Ans. label
13
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Descriptive Question.
1. Mr. Sharma is working in a game development industry and he was comparing the given chart on
the basis of the rating of the various games available on the play store.
He is trying to write a code to plot the graph. Help Mr. Sharma to fill in the blanks of the code and get
the desired output.
import #Statement 1
Rating=[4.2,4.8,5.0,3.8,4.1]
plt. (Games,Rating) #Statement 2
plt.xlabel("Games")
plt. #Statement 4
ii. Identify the name of the function that should be used in statement 2 to plot the above graph.
iv. Choose the right function/method from the following for the statement 4.
v. In case Mr. Sharma wants to change the above plot to the any other shape, which statement, should he change.
14
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
[MARKS IN CBSE-10]
The database system is an excellent computer-based record-keeping system. A collection of data, commonly
called a database, contains information about a particular enterprise. It maintains any information that may be
necessary to the decision-making process involved in the management of that organization.
Need/Advantages of Database
Let us consider some of the benefits provided by a database system and see how a database system overcomes the
above-mentioned problems:-
A Database Management System (DBMS) is a software system that is designed to manage and organize data in a
structured manner. It allows users to create, modify, and query a database, as well as manage the security and
access controls for that database.
DBMS provides an environment to store and retrieve the data in convenient and efficient manner.
Examples:- MySQL,Oracle Database,MongoDB,IBM Db2 DBMS,Amazon RDS,PostgreSQL
15
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
The relational model uses a collection of tables to represent both data and the relationships among those data.
Each table has multiple columns, and each column has a unique name. Tables are also known as relations.
4-Domain:-In database management, a domain is a set of values that can be stored in a column of a database table.
Table/Relation - Student
16
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
6-Attribute: Attributes are the properties that define an entity. e.g.; ROLL_NO, NAME, ADDRESS
Degree: The number of attributes in the relation is known as the degree of the relation. The STUDENT relation
defined above has degree 4
Cardinality: The number of tuples in a relation is known as Cardinality. The STUDENT relation defined above
has cardinality 5.
8-Candidate key: A candidate key in a database management system (DBMS) is a unique identifier for a record
within a table that can be chosen as the primary key. It possesses the essential characteristics required for a
primary key: uniqueness and minimal redundancy. While multiple candidate keys may exist within a table
9-Primary key: The PRIMARY KEY constraint uniquely identifies each record in a table.
Primary keys must contain UNIQUE values, and cannot contain NULL values.
A table can have only ONE primary key; and in the table, this primary key can consist of single or multiple
columns (fields).
10-Alternate key: An alternate key in a Database Management System (DBMS) serves as a candidate key that is
not selected as the
primary key. Its primary purpose is to provide an alternative unique identifier for a record within a table
12-DML: DML is an abbreviation for Data Manipulation Language. Represents a collection of programming
languages explicitly used to make changes to the database such as: create, read, update and delete data.
13-Introduction to MySQL
What is MySQL?
17
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Syntax:-
15-Data Types:-The data type of a column defines what value the column can hold: integer, character, money, date
CHAR(size)-A FIXED length string (can contain letters, numbers, and special characters). The size parameter
specifies the column length in characters - can be from 0 to 255. Default is 1
VARCHAR(size)-A VARIABLE length string (can contain letters, numbers, and special characters). The size
parameter specifies the maximum column length in characters - can be from 0 to 65535 INT(size):-A medium
integer. Signed range is from -2147483648 to 2147483647. Unsigned range is from 0 to 4294967295. The size
parameter specifies the maximum display width (which is 255)
DATE - A date. Format: YYYY-MM-DD. The supported range is from '1000-01-01' to '9999-12-31'
16-CREATE TABLE-The CREATE TABLE statement is used to create a new table in a database.
Syntax
column1 datatype,
column2 datatype,
column3 datatype,
....
);
The column parameters specify the names of the columns of the table.
The datatype parameter specifies the type of data the column can hold (e.g. varchar, integer, date, etc.).
Example:-
18
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
CREATE TABLE Persons (PersonID int, LastName varchar(255), FirstName varchar(255), Address
varchar(255), City varchar(255));
18-ALTER Data Query: The ALTER TABLE statement is used to modify an existing table in a database.
NULL value: The value which is not known or unavailable is called a NULL value. It is represented by blank
space.
NOT NULL: The NOT NULL constraint enforces a column to NOT accept NULL values.This enforces a field
to always contain a value, which means that you cannot insert a new record, or update a record without adding a
value to this field.
CREATE TABLE Persons (ID int NOT NULL, LastName varchar(255) NOT NULL,
It is not possible to test for NULL values with comparison operators, such as =, <, or < >.
We will have to use the IS NULL and IS NOT NULL operators instead.
IS NULL Syntax
SELECT column_names
FROM table_name
19
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
SELECT column_names
FROM table_name
20
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
31-INSERT
32-DELETE
DELETE Syntax
33-UPDATE
UPDATE Syntax
UPDATE table_name
WHERE condition;
21
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
6 Which of the following SQL queries is used to retrieve rows from the"customers" table where 1
the "email"column contains NULL values?
(A) SELECT * FROM customers WHERE email=NULL;
(B) SELECT *FROM customers WHERE email IS NOT NULL;
(C)SELECT * FROM customers WHERE IS NULL (email);
(D) SELECT * FROM customers WHER Eemail IS NULL;
7 Which of the following query will drop a column from a table ? 1
(a) DELETE COLUMN column_name;
(b) DROP COLUMN column_name;
(c) ALTER TABLE table_name DROP COLUMN column_name;
(d) None of these
8 Which of the following is/are the DDL Statement ? 1
(a) Create (b) Drop (c) Alter (d) All of these
9 Which of the following types of table constraints will prevent the entry of duplicate rows? 1
(a) Unique (b) Distinct (c) Primary Key (d) Null
10 Consider the following SQL Statement. What type of statement is this ? 1
INSERT INTO instructor VALUES (10211, ‘SHREYA’ , ‘BIOLOGY’, 69000);
(a) Procedure (b) DML (c) DCL (d) DDL
11 With reference to SQL, identify the invalid data type. 1
(A) Date
22
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
(B) Integer
(C) Varchar
(D) Month
12 Which of the following requirement can be implemented using a CHECK constraint? 1
(a) Student must be greater than 18 years old.
(b) Student must be form a BRICS Country (Brazil, Russia, India, China)
(c) Student’s roll number must exist in another table(say, namely Eligible)
(d) None of these
13 The statement in SQL which allows to change the definition of a table is 1
(a) Alter (b) Update (c) Create (d) select
14 Key to represent relationship between tables is called 1
(a)Primary key (b) Secondary Key (c) Foreign Key (d) None of these
15 It is better to use files than a DBMS when there are 1
(a)Stringent real-time requirements.
(b) Multiple users wish to access the data.
(c) Complex relationships among data.
(d) All of the above.
16 Which of the following is a valid SQL type? 1
(a) CHARACTER (b) NUMERIC (c) FLOAT (d) All of the above
17 The RDBMS terminology for a row is 1
(a)tuple (b) relation (c) attribute (d) degree.
18 State whether the following statement is True or False : 1
In MYSQL, you can write multiple statements in a single line.
19 State whether the following statement is True or False : 1
In MYSQL, PRIMARY KEY and UNIQUE KEY both are the same.
Q-20 and Q-21 are Assertion (A) and Reason (R) Type questions. Choose the correct option as: 1
(A) Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct explanation of
Assertion (A)
(B) Both Assertion (A) and Reason (R) are true, but Reason (R) is not the correct explanation of
Assertion (A)
(C) Assertion (A) is True, but Reason (R) is False
(D) Assertion (A) is False, but Reason (R) is True
20 Assertion (A) : There is a difference between a field being empty or storing NULL value in a 1
field.
Reason (R) : The NULL value is a legal way of signifying that no value exists in the field.
21 Assertion (A): In SQL, INSERT INTO is a Data Definition Language (DDL) Command. 1
Reason (R): DDL commands are used to create, modify, or remove database structures, such as
tables.
22 What is NULL ? How it is different from Zero ? How are NULL values treated by aggregate 2
functions?
23 Rewrite the following SQL statement after correcting the error(s). Underline the corrections 2
made.
INSERT IN STUDENT(RNO, MARKS) VALUEC5, 78.5);
24 Differentiate between alternate key and candidate key 2
25 Name two categories into which SQL commands may be categorized. Also, give one example
of SQL commands in each category.
23
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
26 Define the term Primary Key in a database. Explain how it is different from a Candidate Key. 2
(B) Write SQL Query to insert the following data in the Students Table
24
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
25
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
(d) To display gcode and prize money of those Prize money is less than 10000.
(e) To Display the all Record those prizeMoney in 4000,5000,9000,10000,15000.
37 5
ANSWERS
Q ANSWERS Marks
No
9 (a) Unique 1
10 (b) DML 1
11 (D) Month 1
26
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
13 (a) Alter 1
17 (a)tuple 1
18 True 1
19 False 1
20 (A) Both Assertion (A) and Reason (R) are true, and Reason (R) is the correct 1
explanation of Assertion (A)
21 (C) Assertion (A) is True, but Reason (R) is False 1
22 Null is a Specifier / Constraint represents that the actual value is absent for the 2
particular column. Null is different from zero because zero is a Numeric Value that can
be used in Arithmetic / Logical operations but NULL can not be used like this. None of
the aggregate functions takes NULL into consideration. NULL is simply
Ignored by all the aggregate functions excepts COUNT(*).
2 marks for correct answer with example
24 The attribute or a combination of attributes that have unique values for each record 2
known as candidate key whereas a candidate key that is not the primary key is
known as an alternate key.
(ii) DML DML stands for Data Manipulation Language. The DML commands are
used to insert, display, delete or change data in tables,
E.g.,
SELECT, INSERT, UPDATE, DELETE, etc., commands are of this category.
26 Primary Key : A set of attributes that can uniquely identify each row in a table 2
(relation). It must contain unique values and cannot be null.
How it differs from Candidate Key
There can be multiple Candidate Keys in a table (relation), but only one of them is
selected as Primary Key.
(1 mark for correct definition)
(1 mark for correct difference)
27 Correct query is SELECT * FROM TRANSACTIONS WHERE Amount > 800; 2
27
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
30 Cardinality = 4 2
Degree = 3
Cardinality are the number of rows and degree is number of the columns in a table.
31 (A) 2+1
CREATE TABLE STUDENTS (
StudentID NUMERIC PRIMARY KEY,
FirstName VARCHAR(20),
LastName VARCHAR(10),
DateOfBirth DATE,
Percentage FLOAT(10,2));
(2 mark for correct creation of Table)
(B)
INSERT INTO STUDENTS (StudentID, FirstName, LastName, DateOfBirth,
Percentage) VALUES (1, 'Supriya', 'Singh', '2010-08-18', 75.5);
(1 Mark for correct insert Query)
32 A. USE Pets; 3
B. SHOW TABLES;
C. DESCRIBE horse;
33 Data Definition Language (DDL) is responsible for all database schemas and
describes how data should be stored in the database. DDL includes commands
such as CreateTABLE and ALTER TABLE.
Data Control Languages (DCL) are associated with permits and grants. In short,
these define the authorization to access any part of the database.
34 i. update emp set salary=salary+1000;
ii. update emp set empid=empid-10 where gender=’M’;
iii. update emp set department=’HR’ where empname=’Mahesh’;
iv. update emp set empname=’Manish Saini’, salary=50000 where empid=603;
v. update emp set department=’Fin’ where department=’Finance’;
35 i. Select * from student; 5
ii. Select name from student;
iii. Select name,class from student;
iv. Select * from student where class=’XII’;
v. Select name from student where gender=’M’;
36 (a) SELECT GameName FROM GAMES;
(b) SELECT * FROM GAMES WHERE PrizeMoney > 7000;.
(c) SELECT DISTINCT(GameName) FROM GAMES;
28
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
2) Students do not write actual names of columns which are in tables. It causes
error like unknown column…..
3) Some students write answers of MySQL query using Pandas, Series or DataFrame
concept.
4) They write degree in place of cardinality and vice-versa.
5) While writing degree of a table students count column level as a record.
6) The students forgot to enclose string and date within single or double quotes
while writing insert command.
7) Students forget to write semicolon at the end of the query.
29
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
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 (*).
MySQL Function: It is a special type of predefined command set that performs some operation and returns a single value.
Work on each individual row of a table and return result Work on multiple rows together of a table and return a summary result for a
for each row. group of rows.
Can be used with SELECT clause, WHERE clause or any Commonly used with Group by clause. It may be used without Group by clause
other clause where individual row is concerned. too, where grouping is concerned against a particular column.
ROUND(N,D) If D=0, it rounds off the number to nearest integer. SELECT ROUND(345.3857,2); 345.39
MOD(A,B) Returns the remainder after dividing number A by Number B SELECT MOD(45,7); 3
30
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Common mistakes
MySQL QUERY X Y Output Remarks
committed by students
SELECT POW(3,4); 3 4 81 3 x 3 x 3 x 3 = 81
Students’
MySQL QUERY N D Output Common Remarks
mistakes
31
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Common
mistakes
Function Description Examples Output Remarks
committed
by students
If the string is
already in upper
case/mixed case. Converts string
Converts string into
They into upper case,
upper case. Both the
UCASE (string)/ UPPER Select misinterprets to Whether the
functions work the KENDRIYA string is
(string) same, only the name is ucase(‘KendDriya’); change it to
upper/lower or
different. lower/reverse mixed case
cases of .
respective mixed
case.
If the string is
already in lower
case/mixed case. Converts string
They into lower case,
Converts string into
LCASE (string)/ LOWER Select misinterprets to Whether the
lower case. Both the
kendriya string is
(string) functions work the lcase(‘KendDriya’); change it to
upper/lower or
same, only the name is upper/reverse mixed case
different. cases of .
respective mixed
case.
In MySQL
Returns a substring of Misinterprets
indexing starts
MID (string,pos,n)/ size n starting from indexing like
from 1. Here n
SUBSTRING(string,pos,n)/ specified position(pos) Select mid(‘Kendra python starts
Ndra V is total no of
of the string. All three Vidya’,3,6); from 0. And
functions work the characters to be
SUBSTR (string,pos,n)
same, only the name is extracted from
n is stop position.
different. the given string.
2nd argument is
Returns N no of
Select mandatory
RIGHT (string, N) characters from the riya
right(‘KenDriya’,4); otherwise will
right side of the string.
give error.
Select Misinterprets
LTRIM () Returns the given KenDra Leading means
leading and
string after removing ltrim(‘ KenDra ’); from start. And
trailing white
32
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
33
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
B. Date Functions
Common
mistakes
Function Description Examples Output Remarks
committed
by students
MONTH (‘yyyy-mm-dd’)
MONTHNAME (‘yyyy-
mm-dd’)
It returns the month Select
Or name from the specified January
date/time expression. monthname(‘2025-01-07’); Misinterpret
MONTHNAME (‘yyyy- date format in
mm-dd hh:mm:ss’) the form of
It will
‘2025-Jan-07’
YEAR (‘yyyy-mm-dd’) return null.
It returns the year in or
Select
Or numeric form from
2025 ’07-01-2025’
specified date/time
YEAR (‘yyyy-mm-dd year(‘2025-01-07’);
expression.
hh:mm:ss’)
DAY (‘yyyy-mm-dd’)
It returns the day in
Select
Or numeric form from
7
specified date/time
DAY (‘yyyy-mm-dd day(‘2025-01-07’);
expression.
hh:mm:ss’)
DAYNAME (‘yyyy-mm-
dd’)
It returns the day name Select
Or from the specified Tuesday
date/time expression. dayname(‘2025-01-07’);
DAYNAME (‘yyyy-mm-
dd hh:mm:ss’)
34
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Common mistakes
Function Description Examples Output committed by Remarks
students
COUNT(*)
It counts the number of
counts all
rows in a given Confusing COUNT(*)
rows, including
COUNT ( * ) column/expression Select count(*) from Dept; 4 with
those with
including NULL & COUNT(column_name):
NULL values in
duplicate values.
any column.
35
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
i.
Students of CBSE Class 12 Informatics Practices often make several common mistakes in the MySQL functions chapter during board examinations.
Here are some of these mistakes along with suggestions:
1. Misuse of Aggregate Functions (SUM, AVG, COUNT, MAX, MIN)
Mistake: Using aggregate functions without a GROUP BY clause when grouping is required.
Solution: Ensure to use the GROUP BY clause when you need to apply aggregate functions on grouped data.
SELECT DNAME, SUM(Amt)
FROM Dept
GROUP BY DNAME;
2. Misunderstanding of WHERE vs HAVING Clause
Mistake: Using HAVING instead of WHERE for filtering rows before aggregation.
Solution: Use WHERE to filter rows before applying aggregate functions, and HAVING to filter the results of aggregate functions.
SELECT DNAME, SUM(Amt) FROM Dept
WHERE Amt > 100
GROUP BY DNAME
HAVING SUM(Amt) > 200;
3. When the question is to write a query, then students committed mistakes like they forget to use select command with above functions.
They are confusing with SUBSTR(),INSTR() functions.
Solved Question Answer
Q1. In column ‘Margin’ contains the data set (2.00, 2.00, NULL, 4.00, NULL, 3.00, 3.00).What will be the output after the execution of
the given query? SELECT AVG(Margin) from SHOP;
(a) 2.80 (b) 2 (c) 2.0 (d) error Ans: (a) 2.80
Q2. Help Gargi in predicting the output of the following SQL command.
select INSTR('Informatics Practices','for')-LENGTH('Informatics');
(a) -8 (b) 8 (c) 7 (d) -7 Ans: (a) -8
Q3. To find the cardinality of the database table, student, we can use
a)select count( ) from student; b)Select count( * ) from student;
c)Select count(student) from student; d)Select count(rows) from student; Ans: b)Select count( * ) from student;
Q4. Match the following SQL functions/clauses with their descriptions:
36
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
1 Chaises Living 11500 i. Display all the records in descending order of price.
ii. Display the type and total number of items of each type.
2 Accent Chairs Living 31000 iii. Display the average price of each type.
Q9. Gargi, Who works as a database designer, has developed a database. This database includes a table Stock whose
column(attribute) names are mentioned below:
PID: Shows the unique code for each product
PNAME : Indicates the product Name
Category: Indicates the product category such as Input,Output or Network
Qty: Indicates the quantity of product
Price: Indicates the price of product
(a) Write SQL query to display product name in lowercase. (b) Write SQL query to display the highest price among the product.
(c) Write SQL query to display the number of characters in each product name.
(d) Write SQL query to display the product code and price sorted by price in descending order.
Solution: (a) select lower(Pname) from stock; (b) select max(price) from stock;
(c) select pname,length(pname) from stock; (d) select pid,price from stock order by price desc;
Q10. Dr Divya has created a database for a hospital’s pharmacy. The database includes a table name medicine whose column(
attribute) names are mentioned below:
MID: Shows the unique code for each medicine
Med_Name: Shows the name of medicine
Supp_city: specifies the city where the supplier is located
Stock: indicates the quantity of the medicine available
Del_date: specifies the date when the medicine was delivered.
37
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
(b ) (d)
Med_name min(stock)
PARACETAMOL 50
Q1.
38
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
I. Write SQL query for display the number of characters in book name.
II. Write SQL query for display the books published in the month of October
III. Write SQL query for displaying the book name with quantity,having the quantity available between 30 to 50
IV. Write SQL query for display the name of latest books published.
What is Network? A group of two or more similar things or people interconnected with each
other is called network
Computer Network: A computer network is an interconnection among two or more
computers to share data and resources.
Type of Network: Based on the geographical area covered and data transfer rate, computer
networks are broadly categorised as –
LAN (Local Area Network)
MAN (Metropolitan Area Network)
WAN (Wide Area Network)
PAN (Personal Area Network)
Local Area Network (LAN): Local Area Network (LAN) is a network that connects digital
devices placed at a limited distance of upto 1 km.
Metropolitan Area Network (MAN): Metropolitan Area Network (MAN) is an extended form
of LAN which covers a larger geographical area like a city or a town.
Wide Area Network (WAN) :Wide Area Network (WAN) connects computers and
other LANs and MANs, which are spread across different geographical locations of a country
or in different countries or continents.
Ethernet: The protocol or the set of rules that decide functioning of a LAN is called
Ethernet.
39
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Networking Device: The hardware used in networking known as networking devices. These
are-
Repeater: A repeater is an electronic device that receives a weak signal and
regenerates it.
MODEM: Modem (MOdulator DEMolulator) refers to any such device used for
conversion between analog signals and digital bits.
Hub: A hub is a network device used to connect multiple devices to form a network or
to connect segment(s) of LAN.
Switch: A switch is a networking device that filters network traffic while connecting
multiple computers or communicating devices.
Router: A router is a network device that can receive the data, analyse it and
transmit to other networks.
Gateway: A gateway is a device that connects the organisation’s network with the
outside world of the Internet.
Network Topology: The physical organisation of computers, cables and other peripherals in
a network is called its topology. Common network topologies are
Bus Topology
Star Topology
Tree Topology
Mesh Topology
Bus Topology: In bus topology, each communicating device connects to a common central
transmission medium, known as bus.
Star Topology: In star topology, each communicating device is connected to a central node,
which is a networking device like a hub or a switch, through separate cables.
Tree Topology: In tree topology, multiple star and bus topologies are connected to a central
cable, also called the backbone of the network.
Mesh Topology: In mesh topology, each communicating device is connected with every
other device in the network.
Internet: The Internet is the largest WAN that connects millions of computers across the
globe.
Use of Internet: Some of the services provided through the Internet are information
sharing, communication, data transfer, social networking, e-commerce, etc.
Uniform Resource Locator (URL): A Uniform Resource Locator (URL) is a standard naming
convention used for accessing resources over the Internet.
Electronic mail (email): Electronic mail is a means of sending and receiving message(s)
through the Internet.
Chat: Chatting is communicating in real time using text message(s).
VoIP: Voice over Internet Protocol (VoIP) allows you to have voice calls over digital networks.
Website: A website is a collection of related web pages.
Webpage: A web page is a document that is viewed in a web browser such as Google
Chrome, Mozilla Firefox, Opera, Internet Explorer, etc. It can be static or dynamic.
Static Web Page: A static web page is one whose content does not change for requests
made by different people.
40
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Dynamic Web Page: A dynamic web page is one in which the content of the web page
displayed is different for different users.
Web Hosting: Web hosting is a service that allows you to post the website created locally so
that it is available for all internet users across the globe.
Web Server: A web server is a program or a computer that provides services to other
programs or computers called clients.
Web Browser: A browser is a software application that helps us to view the web page(s) over
the internet. Examples: Google Chrome, Mozilla Firefox, Opera, Internet Explorer, etc.
Web Browser Settings: Every browser has got certain settings that define the manner in
which the browser will behave. These settings may be with respect to privacy, search engine
preferences, download options,auto signature, autofill and autocomplete feature and much
more.
Add-ons and plug-ins: Add-ons and plug-ins are the tools that help to extend and modify
the functionality of the browser.
Cookies: A cookie is a text file containing a string of information which stores browsing
information on the hard disk of your computer.
Important Things to Remember:
1. Placement of Server- where numbers of computers are maximum.
2. Placement of switch/hub – Each block
3. Placement of Repeater- Between the blocks where distance is more than 70 Mtrs.
4. For cable layout/ topology- Try to make either star or bus only.
5. For network security Firewall to be installed.
6. Face to face communication- Video conferencing.
7. For voice call using internet- VoIP
8. Cable should be used in – i) LAN- Eathernet, ii) Co-axial iii) WAN-Fiber optics
Solved Questions:
1. Fill in the blanks:
a) To transmit data for sharing on a network, it has to be divided into smaller chunks called
______________________.
Ans: Packets
b) The set of rules that decide the functioning of a network is called _______. Ans: Protocols
c) A LAN can be extended up to a distance of __________ km. Ans: 1km.
d) The ___________________ connects a local area network to the internet. Ans: Gateway
e) The _____________ topology is of hierarchical nature. Ans: Tree
f) ____________________ is a standard naming convention used for accessing resources over
the Internet. Ans: URI(Uniform Resource Identifier)
g) ______________ is a collection of related web pages. Ans: Website
h) A _____________ is a computer that provides services to other programs or computers.
Ans: Server
41
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
2. MS Global Media Corp campus in Delhi has 4 blocks named A, B, C and D. The tables
given below show the distance between different blocks and the number of computers in
each block.
Block A 35
Block B 15
Block C 26
Block D 49
i) Block A
Justification: It has maximum number of computers
42
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Unsolved Questions
1. Which device is used to regenerate the signals over long distance data transmission:
i. Switch ii. Modem iii. Repeater iv. None of the above
2. which protocol allow us to have voice calls over the internet?
i. HTTP ii. VoIP iii. Video Chat iv. SMTP
3. A computer network created by connecting the computers of your school’s computer lab is an example of
a. LAN b. MAN c. WAN d.PAN
3. Expand the following:
a) ARPANET b) ISP c) URL
4. Name the device for the following:
a) It stands for Modulator Demodulator b) It regenerates the signals.
5. Differentiate between:
a) MAN and WAN b) Website and web page
c) Router and Gateway d) Bus and Star topology
e) Static and Dynamic web pages f) Bus and Star topology
5. The Great Brain Organization has set up its new branch at Srinagar for its office and web based
activities. It has 4 Wings of buildings as shown in diagram:
Wing X to Wing Z 50 m
Wing Z to Wing Y 70 m
Wing Y to Wing U 80 m
Wing Z to Wing U 90 m
Number of Computers
Wing X 50
Wing Z 30
Wing Y 150
Wing U 15
43
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
b) Hub/Switch
(v) The organization is planning to link its head office situated in Delhi with the offices at
Srinagar. Suggest an economic way to connect it; the company is ready to compromise on
the speed of connectivity. Justify your answer.
DIGITAL FOOTPRINT
A digital footprint – refers to the trail of data you leave while using the internet. It includes websites
you visit, emails you send, and information you submit online. A digital footprint can be used to track a
person’s online activities and devices.
Internet users create their digital footprint either actively or passively. A passive footprint is made
when information is collected from the user without the person knowing this is happening. An active
digital footprint is where the user has deliberately shared information about themselves either by using
social media sites or by using websites
Online shopping
● Making purchases from e-commerce websites
Online banking
● Using a mobile banking app
Social media
● Using social media on your computer or devices
44
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
● Be respectful
● Think about who can see what you have shared.
● Read first, then ask
● Pay attention to grammar and punctuation
● Respect the privacy of others
● Do not give out personal information
DATA PROTECTION
Data protection is a set of strategies and processes you can use to secure the privacy, availability, and
integrity of your data. It is sometimes also called data security or information privacy. A data protection
strategy is vital for any organization that collects, handles, or stores sensitive data.
Data Privacy v/s Data Protection
For data privacy, users can often control how much of their data is shared and with whom. For data
protection, it is up to the companies handling data to ensure that it remains private. Data privacy is
focused on defining who has access to data while data protection focuses on applying those restrictions.
How we can protect our personal data online
45
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Intellectual Property (IP) – is a property created by a person or group of persons using their own intellect
for ultimate use in commerce and which is already not available in the public domain. Examples of
Intellectual Property :- an invention relating to a product or any process, a new design, a literary or
artistic work and a trademark (a word, a symbol and / or a logo, etc.)
Intellectual Property Right (IPR) is the statutory right granted by the Government, to the owner(s) of the
intellectual property or applicant(s) of an intellectual property (IP) to exclude others from exploiting the
IP commercially for a given period of time, in lieu of the discloser of his/her IP in an IPR application.
PLAGIARISM
Plagiarism It is stealing someone’s intellectual work and representing it as your own work without citing
the source of information.
Any of the following acts would be termed as Plagiarism:
● Using some other author’s work without giving credit to the author
● Using someone else’s work in incorrect form than intended originally by the author or creator.
● Modifying /lifting someone’s production such as music composition etc. without attributing it to
the creator of the work.
● Giving incorrect source of information.
Licenses are the permissions given to use a product or someone’s creation by the copyright holder.
Copyright is a legal term to describe the rights of the creator of an original creative work such as a
literary work, an artistic work, a design, song, movie or software etc.
OSS refers to Open Source Software, which refers to software whose source code is available to
customers and it can be modified and redistributed without any limitation. Free and open-source software
46
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
(FOSS) is software that can be classified as both free software and open-source software. That is, anyone
is freely licensed to use, copy, study, and change the software in any way, and the source code is openly
shared so that people are encouraged to voluntarily improve the design of the software.
CYBER CRIME
Any criminal or illegal activity through an electric channel or through any computer network is
considered as cyber crime.
Eg: Cyber harassment and stalking, distribution of child pornography,types of spoofing, credit card fraud
,. etc
CYBER LAW
It is the law governing cyberspace which includes freedom of expression, access to and usage of internet
and online privacy.
The issues addressed by cyber law include cybercrime, e-commerce, IPR and Data protection.
HACKING:
It is an act of unauthorised access to a computer, computer network or any digital system.
Hackers usually are technical expertise of hardware and software.
● Hacking when done with a positive intent is called as Ethical hacking or White hat.
● Hacking when done with a negative intent is called as Unethical hacking or Black hat.
PHISHING:
t is an unlawful activity where fake websites or emails appear as original or authentic .This sites when
clicked by the user will collect sensitive and personal details like usernames, password, credit card
details etc.
CYBER BULLYING:
It is the use of technology to harass , threaten or humiliate a target .
Example: sharing of embarrassing photos or videos, posting false information, sending mean text., etc.
47
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
2. Rishika found a crumpled paper under her desk. She picked it up and opened it. It contained some text
which was struck off thrice. But she could still figure out easily that the struck off text was the email ID
and password of Garvit, her classmate. What is ethically correct for Rishika to do?
a) Inform Garvit so that he may change his password.
b) Give the password of Garvit’s email ID to all other classmates.
c) Use Garvit’s password to access his account.
3. Suhana is down with fever. So, she decided not to go to school tomorrow. Next day, in the evening she
called up her classmate, Shaurya and enquired about the computer class. She also requested him to
explain the concept. Shaurya said, “Mam taught us how to use tuples in python”. Further, he generously
said, “Give me some time, I will email you the material which will help you to understand tuples in
python”.
Shaurya quickly downloaded a 2-minute clip from the Internet explaining the concept of tuples in python.
Using video editor, he added the text “Prepared by Shaurya” in the downloaded video clip. Then, he
emailed the modified video clip to Suhana. This act of Shaurya is an example of
a) Fair use
b) Hacking
c) Copyright infringement
d) Cyber crime
4. After a fight with your friend, you did the following activities. Which of these activities is not an
example of cyber bullying?
a) You sent an email to your friend with a message saying that “I am sorry”.
b) You sent a threatening message to your friend saying “Do not try to call or talk to me”.
c) You created an embarrassing picture of your friend and uploaded on your account on a social
networking site.
5. You are planning to go on a vacation to Kashmir. You surfed the internet for the following:
i) Weather conditions
ii) Availabilty of air tickets and fares
iii) Places to visit
iv) Best hotel deals
48
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Which of the above mentioned acts might have left a digital footprint?
a) i and ii
b) i, ii and iii
c) i, ii and iv
d) all of these
6. Naveen received an email warning him of closure of his bank accounts if he did not update his
banking information as soon as possible. He clicked the link in the email and entered his banking
information. Next he got to know that he was duped.
ii) Someone steals Naveen’s personal information to commit theft or fraud, it is called ____________
a. Online Fraud
b. Identity Theft
c. Phishing
d. Plagarism
iv) Naveen’s Online personal account, personal website are the examples of?
a. Digital wallet
b. Digital property
c. Digital certificate
d. Digital signature
v) Sending mean texts, posting false information about a person online, or sharing embarrassing photos
or videos to harass, threaten or humiliate a target person, is called ____________
a. Eavesdropping
b. cyberbullying
c. Spamming
d. Phishing
7. Prathyush has to prepare a project on “Cyber Jaagrookta Diwas”.He decides to get information from
the Internet. He downloads three web pages (webpage1, webpage 2, webpage 3) containing information
on the given topic.
1. He read a paragraph from webpage 1 and rephrased it in his own words. He finally
pasted the rephrased paragraph in his project. And he put a citation about the website he
visited and its web address also.
49
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
2. He downloaded three images of from webpage 2. He made a collage for his project
using these images.
3. He also downloaded an icon from web page 3 and pasted it on the front page of
his project report.
(iv) ______is a small piece of data sent from a website and stored in a user’s web browser while a user is
browsing a website.
(a) Hyperlinks
(b) Web pages
(c) Browsers
(d) Cookies
(v) The process of getting web pages, images and files from a web server to local computer is called
(a) FTP
(b) Uploading
(c) Downloading
(d) Remote access
8. What are intellectual property rights (IPR), and why are they important in the digital world?
Ans. Intellectual Property Rights (IPR) These are legal rights that protect the creations of the human
intellect. The nature of these works can be artistic, literary or technical etc.
Importance in the digital world These rights help prevent the unauthorized use or reproduction of
digital content and ensure that creators are fairly compensated and incentivized for their original work.
9. Mention two health concerns associated with excessive use of Digital Devices.
Ans. Two health concerns due to excessive use of Digital Devices:
a) Eye strain and vision problems.
b) Musculoskeletal issues like neck and back pain.
50
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
10. Ayesha's family is replacing their old computer with a new one. They decide to throw the old
computer in a nearby empty field/plot.
I. Explain any one potential environmental hazard associated with improper e-waste disposal.
II. Suggest one responsible way to Ayesha's family for proper disposal of their old computer.
III. Describe the importance of recycling in e-waste management.
Ans. I. E-waste can release harmful substances like lead and mercury into the environment.
II. They can donate or sell it to a certified e-waste recycling center.
III. Recycling e-waste helps conserve natural resources and reduces pollution.
11. 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. 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.
Ans. i. She is a victim of Cyber Bullying.
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.
12. Differentiate between the active digital footprint and passive digital footprints.
Ans. 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.
51
MLL MATERIAL, CLASS XII INFORMATICS PRACTICES, KVS RO LUCKNOW
Failing to include real-life examples (e.g., famous cases of data breaches, impactful
cyberbullying incidents, or well-known e-waste recycling initiatives).
Questions that use case studies, examples, or hypothetical scenarios require analytical
thinking, which some students may struggle with.
52